我必须将 composite-id (xml) 重写为 JPA
I have to rewritew composite-id (xml) to JPA
这是我的 xml 映射。我需要制作 JPA 映射
<composite-id>
<key-property name="systemId" type="integer" column="SYSTEM_ID"/>
<key-property name="rollingRackId" type="integer" column="ROLLING_RACK_ID"/>
</composite-id>
<property name="status" type="integer" column="ROLLING_RACK_STATUS"/>
<property name="changeTime" type="timestamp" column="CHANGE_TIME" />
</class>
你要引入一个Idclass
@Entity @IdClass(KeyClass.class)
public class Entity{
@Id int systemId;
@Id int rollingRackId;
}
class KeyClass{
int systemId;
int rollingRackId;
}
这是我的 xml 映射。我需要制作 JPA 映射
<composite-id>
<key-property name="systemId" type="integer" column="SYSTEM_ID"/>
<key-property name="rollingRackId" type="integer" column="ROLLING_RACK_ID"/>
</composite-id>
<property name="status" type="integer" column="ROLLING_RACK_STATUS"/>
<property name="changeTime" type="timestamp" column="CHANGE_TIME" />
</class>
你要引入一个Idclass
@Entity @IdClass(KeyClass.class)
public class Entity{
@Id int systemId;
@Id int rollingRackId;
}
class KeyClass{
int systemId;
int rollingRackId;
}