HIbernate 1+n问题

1+n问题

当一个对象关联着另外一个对象,Fetchtype是eager的话;取个对象的时候,被关联的对象就会单独再发sql语句

解决方法

1.FetchType设为LAZY(fetch=FetchType.LAZY)

2.BATCHSIZE

3用createCretira(join fetch)

原文地址:https://www.cnblogs.com/bashala/p/3276464.html