net.sf.json.JSONException: There is a cycle in the hierarchy! 解决方法
来源:互联网 发布:学淘宝运营要多长时间 编辑:程序博客网 时间:2024/06/05 19:14
通常出现这个问题就是hibernate主外键关联的错误,因为存在相互关联的问题,所以在bean转换成json的时候会不断的拆开实体属性,直到没有为止。
解决方法一:hibernate使用lazy=true(懒加载)的方法,相应的字段在没有主动请求的时候不加载数据
解决方法二:
JsonConfig cfg = new JsonConfig(); cfg.setJsonPropertyFilter(new PropertyFilter() { public boolean apply(Object source, String name, Object value) { if(name.equals("XX")||name.equals("XX")) { return true; } else { return false; } } });使用这种方法将相应的属性进行过滤
最后调用
JSONArray.fromObject(mychildren,cfg);
就没有问题了
0 0
- net.sf.json.JSONException: There is a cycle in the hierarchy异常,解决方法
- net.sf.json.JSONException: There is a cycle in the hierarchy异常的解决方法
- net.sf.json.JSONException: 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!
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- net.sf.json.JSONException: There is a cycle in the hierarchy
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- net.sf.json.JSONException: There is a cycle in the hierarchy!错误解决方案
- net.sf.json.JSONException: There is a cycle in the hierarchy
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- net.sf.json.JSONException: There is a cycle in the hierarchy!
- 日志打包压缩
- Android 自定义可移动土司及多击事件
- 滑轮控件研究四、VelocityTracker的简单研究
- Quartz 2D绘图简介
- 题目1512:用两个栈实现队列
- net.sf.json.JSONException: There is a cycle in the hierarchy! 解决方法
- Android Animation动画(很详细)
- 对 “句柄” “指针” 有下面的描述(AfxGetMainWnd GetSafeHwnd() AfxGetAppName() AfxGetThread)
- curl处理https 融云接口php
- Android DiskLruCache磁盘缓存
- Java--Timer类研究
- VL02N修改外交货的表头数据的BAPI
- python 火车票监控12306
- LeetCode[Tree]: Populating Next Right Pointers in Each Node II