正在使用Ebeans與Play2.0.2 我有兩個模型是這樣的:例外與Ebean一對多
@Entity
@Table(name="GRP_MST")
public class GroupMst extends Model {
@Id
@Constraints.Required
@Formats.NonEmpty
public String groupid;
......
@OneToMany(cascade = CascadeType.ALL)
public List<DtlMenuGrp> dtlMenuGrpList; // This one is giving problems
}
而且我DtlMenuGrp
型號的樣子:
@Entity
@Table(name="DTL_MENU_GRP")
public class DtlMenuGrp extends Model {
@Constraints.Required
@Formats.NonEmpty
public String groupid;
....
}
我想加入上述兩個我的控制器中的型號如下:
GroupMst groupMst = GroupMst.find.where().eq("groupid",data.get("grpid")).findUnique();
List<DtlMenuGrp> dtlMenuGrpList = groupMst.dtlMenuGrpList;
但是這給了我下面的Ex列cpetion未發現:
Caused by: javax.persistence.PersistenceException: Query threw SQLException:Invalid column name 'group_mst_groupid'.
Bind values:[1000]
Query was:
select t0.groupid c0
, t1.groupid c1, t1.rightid c2, t1.status c3, t1.createdby c4, t1.createdon c5
from GRP_MST t0
left outer join DTL_MENU_GRP t1 on t1.group_mst_groupid = t0.groupid
where t0.groupid = ?
order by t0.groupid
爲什麼我的列鑄成的group_mst_groupid
代替groupid
你是如何創建1.sql進化的?你是自己寫的,還是用Ebean自動創建的? – biesior 2012-08-08 15:01:13