Nhibernate Bug could not initialize proxy -no Session

       在<many-to-one>中遇到这种错误就是不能被初始化,session已经关闭。原因是Nhibernate 默认使用lazy = true 。所以解决办法一:

  • 在实体的hbm.xml的<many-to-one>里面添加lazy="false"

猜你喜欢

转载自blog.csdn.net/li_super/article/details/80962005