could not initialize proxy

来源:互联网 发布:网络通信系统 编辑:程序博客网 时间:2024/06/09 20:57



压入栈顶转json,出错

failed to lazily initialize a collection of role: cn.itcast.bos.domain.base.Courier.fixedAreas, could not initialize proxy - no Session    //domain中有一个成员变量无非加载,即,懒加载

Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: cn.itcast.bos.domain.base.Courier.fixedAreas, could not initialize proxy - no Session



action类

@Action(value="courier_pageQuery",results={@Result(name="success",type="json")})public  String pageQuery(){//page其初始值位0Pageable pageable=new PageRequest(page-1, rows);Page<Courier>pageData=courierService.findPageData(pageable);//将转回的pagedata对象装回datagrid需要格式Map<String, Object> result=new HashMap<>();result.put("total", pageData.getTotalElements());//返回所有内容result.put("rows", pageData.getContent());ActionContext.getContext().getValueStack().push(result);return SUCCESS;}


数据的懒加载