解决org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernat

参见文章,hibernate版本3.6.10

在父表的hbm.xml文件中将子表关部分联的many-to-one添加的lazy="false"

<many-to-one name="devicemanufacturer" class="com.test.iv.cms.orm.pojo.Devicemanufacturer" fetch="select" lazy="false">
将fetch改为join也可以

你可能感兴趣的:(解决org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernat)