解决在转化json过程中,hibernate外键的死循环问题

来源:互联网 发布:如何同意淘宝试用协议 编辑:程序博客网 时间:2024/05/29 09:38

报错为:net.sf.json.JSONException: There is a cycle in the hierarchy!

SSH框架Action里面代码如下:

List list=checkService.getallcheck();

//下面三行代码

 JsonConfig jsonConfig = new JsonConfig();  //建立配置文件
 jsonConfig.setIgnoreDefaultExcludes(false);  //设置默认忽略
 jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);  

JSONArray jsonArray=JSONArray.fromObject(list,jsonConfig);
原创粉丝点击