【发布时间】:2014-07-22 09:34:45
【问题描述】:
我有一个班级系统
@Entity
abstract class System{
@Id
int systemId;
//setter and getters..
}
由类扩展
@Entity
class PhysicalSystem extends System
{
@Id
int place;
//setter and getters..
}
需要使用systemId和place来制作复合键 我怎么能这样做..如果我在两个类中都有@Id,它会抛出异常
Initial SessionFactory creation failed.java.lang.ClassCastException: org.hibernate.mapping.JoinedSubclass cannot be cast to org.hibernate.mapping.RootClass
我该如何解决这个问题?
表格:
System{
systemid PK
systemName
}
PhysicalSystem
{
systemId PK
locationId PK
}
【问题讨论】:
-
您能发布您所涉及的表格吗?
-
用表格编辑问题
标签: java hibernate hibernate-mapping hibernate-annotations