1.向表中插入一个字段unit_id,然后回到modle类进行配置;
2.在modle里面开始配置
brand:
private TbUnit tbUnit;get,set方法;
unit:
private Set<TsBrand> brands;get,set方法;
然后配置xml:
TsBrand.hbn.xml:
<many-to-one name="tbUnit" column="unit_id" class="net.yasion.common.model.TbUnit" />
TbUnit.hbm.xml:
<set name="brands" inverse="true" cascade="delete" where="(NOT(flag = 'D') OR flag IS NULL)">
<key>
<column name="unit_id">
<comment>单位ID</comment>
</column>
</key>
<one-to-many class="com.yaheen.model.TsBrand" />
<set>
3.打开页面:
HTTP Status 500 - Request processing failed; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [net.yasion.common.model.TbUnit#];
4.原因: