当我们配置完OpenSessionInViewFilter,或者把转换对象为json字串的操作放到了事务里面以后,仍然报错 :java.lang.NoSuchMethodException: Property 'delegate' has no getter method  .

一种解决方案:


JsonConfig config = new JsonConfig();

config.setExcludes(new String[]{"one2many的字段集合名称", "hibernateLazyInitializer","handler","tProvince"});

JSONArray jsonArray = JSONArray.fromObject(dao.getAll(rowStartIdxAndCount),config);

return jsonArray.toString();