json转换数据时候,报there is a cycle in the hierarchy!
来源:互联网 发布:磁力链接搜索引擎源码 编辑:程序博客网 时间:2024/05/16 13:01
//设置json过滤主外键,防止出现死循环there is a cycle in the hierarchy! JsonConfig config = new JsonConfig();config.setJsonPropertyFilter(new PropertyFilter(){//过滤属性//其中houses,district就是我们要过滤的字段,也就是JavaBean中的属性名public boolean apply(Object arg0, String name, Object arg2) {if(name.equals("houses")||name.equals("district")){return true;}return false;}});//在转换的时候加个configJSONArray jsarr = JSONArray.fromObject(streetList,config);request.setAttribute("jsarr", jsarr);}
这个异常,是由于,json在转换数据的时候,能够检测出要转换的属性之间存在着主外键关系,特别是hibernate在操作数据的时候,造成了死循环,解决办法,就是用JsonConfig提供的一个过滤属性的方法,实现里面的apply的方法,然后将要过滤的属性进行判断。这样就可以解决这个问题了。
- json转换数据时候,报there is a cycle in the hierarchy!
- 使用JSONObject转换json数据报错:There is a cycle in the hierarchy!的解决办法
- json-lib There is a cycle in the hierarchy!
- JSON There is a cycle in the hierarchy异常
- Json转换成字符串,There is a cycle in the hierarchy解决办法
- JSON 转换异常 死循环 There is a cycle in the hierarchy
- There is a cycle in the hierarchy
- There is a cycle in the hierarchy !!!
- There is a cycle in the hierarchy
- There is a cycle in the hierarchy
- There is a cycle in the hierarchy!
- 使用Json-lib转换json字符串出现There is a cycle in the hierarchy!时的解决方案
- jQuery调用JSON时,net.sf.json.JSONException: There is a cycle in the hierarchy
- jQuery调用JSON时,net.sf.json.JSONException: There is a cycle in the hierarchy
- json中net.sf.json.JSONException: There is a cycle in the hierarchy!的解决
- Json解析时出现net.sf.json.JSONException: There is a cycle in the hierarchy!42
- jQuery调用JSON时,net.sf.json.JSONException: There is a cycle in the hierarchy
- jQuery调用JSON时,net.sf.json.JSONException: There is a cycle in the hierarchy!
- 08-一个IP绑定多个域名(根据ServerName)
- windows下LIB和DLL的区别与使用
- Stones(hdu1896)优先队列
- 存储入门框架
- HDU 4618 Palindrome Sub-Array (HASH + 枚举)
- json转换数据时候,报there is a cycle in the hierarchy!
- N的N次方
- CSDN暑假学习记事
- SecureCRT向Linux系统传送和接收文件
- mscs下oracle数据库安装
- QT插件学习
- 【专题】图的连通性问题
- HDU 4601 Letter Tree
- hdu 1429 胜利大逃亡(续)