我在 Play2.0.2 中使用 Ebeans 我有两个这样的模型:
@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;
但这给了我以下找不到列的例外情况:
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