休眠映射
问题描述:
我得到了一个PK表和一个值为“country”的表,我的所有标签都在另一个具有composite-id的表中定义。休眠映射
有没有人有一个例子我怎么可以在其他表我的祖国值映射到正确的标签吗?
映射绑定在PK上,如果我没有错的话。
<class name="hibernate.P1" table="P1">
<id name="id" type="int">
<column name="LFNR" precision="7" scale="0" />
</id>
<property name="land" type="int" not-null="true">
<column name="LAND" precision="1" scale="0" />
</property>
<class name="hibernate.P5" table="P5">
<composite-id name="Id" class="hibernate.P5Id">
<key-property name="tab" type="string">
<column name="TAB" length="4" />
</key-property>
<key-property name="lfnr" type="string">
<column name="LFNR" length="4" />
</key-property>
<key-property name="usa" type="string">
<column name="USA" length="4" />
</key-property>
<key-property name="hier" type="int">
<column name="HIER" precision="2" scale="0" />
</key-property>
<key-property name="land" type="int">
<column name="LAND" precision="3" scale="0" />
</key-property>
<key-property name="sart" type="string">
<column name="SART" length="3" />
</key-property>
</composite-id>
<property name="label" type="string">
<column name="LABEL" length="50" />
</property>
.....
我不能悲伤地改变分贝的布局。
答
因为你不能保证只有一行将在P5表在P1给定的行,您应该在P1一到多,即一组本身包含P5的一个元素。
到目前为止,请小心给我们您的映射? – cherouvim 2009-12-08 10:13:21
Ofc,检查我的更新。 – onigunn 2009-12-08 10:19:45