1、访问懒加载的属性一定要开启事务,如果不需要开启事务,那么就必须将懒加载的属性设置为false
2、不是所有的语句都要去查数据库,例如待条件查询的select语句 ----select o where User o where o.name=“bain”;
但是像是select o where User o 就一定会去查询数据库
本文共 212 字,大约阅读时间需要 1 分钟。
1、访问懒加载的属性一定要开启事务,如果不需要开启事务,那么就必须将懒加载的属性设置为false
2、不是所有的语句都要去查数据库,例如待条件查询的select语句 ----select o where User o where o.name=“bain”;
但是像是select o where User o 就一定会去查询数据库
转载于:https://my.oschina.net/hotbain/blog/75576