failed to lazily initialize a collection of role

    今天写hibernate的一对多的时候出现failed to lazily initialize a collection of role这个错误,找了好久没发现是什么地方错了,后来发现要在属性中添加lazy="false"
例如: <set name="lineOrders" table="LINEORDER" lazy="false" cascade="save-update">
         <key column="ORDER_ID"/>
         <one-to-many class="com.NetShop.Model.LineOrder"/>
        </set>
现在可以run了,但还不知道为什么这样改,过会儿查一下为什么,呵呵,初学hibernate。
posted @ 2007-12-24 13:21  yiling  阅读(5046)  评论(1编辑  收藏  举报