JSONArray 报错: NoSuchMethodException: Property 'delegate' has no getter method

当我们配置完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();

相关文章

AJAX是一种基于JavaScript和XML的技术,能够使网页实现异步交...
在网页开发中,我们常常需要通过Ajax从后端获取数据并在页面...
在前端开发中,经常需要循环JSON对象数组进行数据操作。使用...
AJAX(Asynchronous JavaScript and XML)是一种用于创建 We...
AJAX技术被广泛应用于现代Web开发,它可以在无需重新加载页面...
Ajax是一种通过JavaScript和HTTP请求交互的技术,可以实现无...