Hibernate联合主键
主键xml
<composite-id>
<key-property name="homeNo" column="homeNo" length="2"
type="String" />
<key-property name="homeprice" column="homeprice" length="2"
type="integer"/>
</composite-id>
<set name="lodingInformation" inverse="true" lazy="true" cascade="delete">
<key>
<column name="homeprice"/>
</key>
<one-to-many class="cust.hotel.vo.LodingInformation"/>
</set>
<set name="lodingInformation" inverse="true" lazy="true" cascade="delete">
<key>
<column name="homeNo"/>
</key>
<one-to-many class="cust.hotel.vo.LodingInformation"/>
</set>
外键xml
<many-to-one name="homeNo" class="cust.hotel.vo.HomeInformation" lazy="false" unique="true" cascade="save-update">
<column name="homeNo"/>
</many-to-one>
<many-to-one name="homeprice" class="cust.hotel.vo.HomeInformation" lazy="false" unique="true" cascade="save-update">
<column name="homeprice"/>
</many-to-one>
程序还没完全跑起来,不保证对