我有 3 张桌子:
Table A(Col1,Col2,Col3) -- Col1 Primary Key
Table B(Col4,Col5,Col6) -- (Col4,Col5) --Composite Key
Table C(Col7,Col8,Col9,Col10) --(Col7,Col8,Col9) -- Composite key References (Col1,Col4,Col5)
这个表 C 是如何hibernate
映射的?
你不能只制作里面有复合键的复合键吗?
像这样的东西:
<composite-id name="id" class="com.domain.CompositeTableC">
<key-property name="col1" type="string">
<column name="Col1" length="8" />
</key-property>
<key-property name="col4" type="string">
<column name="Col4" length="8" />
</key-property>
<key-property name="col5" type="string">
<column name="Col5" length="8"/>
</key-property>
</composite-id>
和班级:
public class CompositeTableC{
//constructors
private String col1;
private CompositeTableB compositeB;
//getters and setters
}
public class CompositeTableB {
//constructors
private String col4;
private String col5;
//getters and setters
}