小编Mar*_*ski的帖子

ebean和play框架中的复合键

我刚开始使用Play Framework.完成教程(涵盖基本功能)后,我尝试在数据库和播放之间建立连接.我的一个关系有架构:

CREATE  TABLE IF NOT EXISTS `shop`.`CatPath` (
  `parentC` INT NOT NULL ,
  `childC` INT NOT NULL ,
  `depth` INT NOT NULL ,
  PRIMARY KEY (`parentC`, `childC`) 
  )
Run Code Online (Sandbox Code Playgroud)

所以我建立了模型的类:

@Entity
public class CatPath extends Model {

@EmbeddedId 
public CatPathKey key;
public Long depth;

public class CatPathKey {

        public Long parentC;
        public Long childC;
}   

public static Finder<CatPathKey, CatPath> find = new Finder<CatPathKey, CatPath>(CatPathKey.class, CatPath.class);
Run Code Online (Sandbox Code Playgroud)

编译后我得到异常:

PersistenceException: Could not find BeanDescriptor for class models.CatPath$KatPathKey. Perhaps the EmbeddedId class is not …
Run Code Online (Sandbox Code Playgroud)

ebean playframework-2.0

4
推荐指数
1
解决办法
5482
查看次数

标签 统计

ebean ×1

playframework-2.0 ×1