压入栈顶转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其初始值位0
Pageable 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;
}
数据的懒加载