环境 spring+hibernate3+struts 今天又碰到错误 failed to lazily initialize a collection of role: no session or session was closed 试验了一下发现了几个解决方法: 1、是把对应一对多的那两个列lazy=true改为lazy=false即可 2、对于查询中如果用的是xxx.load(class,id)则改为xxx,get(class,id) <filter> <init-param> <!--这个-- <init-param>一定要加不然很可能会报错:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition <filter-mapping> |
failed to lazily initialize a collection of role:
最新推荐文章于 2024-06-17 09:21:36 发布
大
中
小