使用了一个单向<one-to-many>关系,其中:
<set
name="sysCodes"
table="D_SYS_CODE"
where="TYPE_CODE='0'"
lazy="false"
inverse="true"
>
<key
column="SYS_CODE"
property-ref="sysTypeCode" <---------------
/>
<one-to-many
class="cn.com.evin.cdc.hibernate.DSysCode"
/> </set> 由于是老数据库,所以必须要用property-ref来指定非主健的外键,但我一加上上面箭头标识的那一行,运行时就要报“org.springframework.orm.hibernate3.HibernateSystemException: collection is not associated with any session;”异常,是什么原因呢?
<set
name="sysCodes"
table="D_SYS_CODE"
where="TYPE_CODE='0'"
lazy="false"
inverse="true"
>
<key
column="SYS_CODE"
property-ref="sysTypeCode" <---------------
/>
<one-to-many
class="cn.com.evin.cdc.hibernate.DSysCode"
/> </set> 由于是老数据库,所以必须要用property-ref来指定非主健的外键,但我一加上上面箭头标识的那一行,运行时就要报“org.springframework.orm.hibernate3.HibernateSystemException: collection is not associated with any session;”异常,是什么原因呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货