hibernate报错 net.sf.json.util.CycleDetectionStrategy$StrictionStrategyRepeatedReferenceAsObject
生活随笔
收集整理的這篇文章主要介紹了
hibernate报错 net.sf.json.util.CycleDetectionStrategy$StrictionStrategyRepeatedReferenceAsObject
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
=執行{+com.j.serviceimpl.ArticleServiceimpl+}類的的+97+行的+selectAllByIdS+()方法,
===異常信息為:{} There is a cycle in the hierarchy!
net.sf.json.JSONException: There is a cycle in the hierarchy!
at net.sf.json.util.CycleDetectionStrategy$StrictCycleDetectionStrategy.handleRepeatedReferenceAsObject(CycleDetectionStrategy.java:97)
at net.sf.json.JSONObject._fromBean(JSONObject.java:833)
原因是:在級聯查詢時json轉換級聯對象,,自關聯然后死循環報錯
解決辦法:
JsonConfig jsonConfig = new JsonConfig();jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);Articl articln=super.baseDaoImpl.selectAllByIdD(Articl.class.getName(), idInteger);JSONObject json =JSONObject.fromObject(articlebean, jsonConfig);String result = json.toString(); 與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的hibernate报错 net.sf.json.util.CycleDetectionStrategy$StrictionStrategyRepeatedReferenceAsObject的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java批量完成对文件夹下全部的css与
- 下一篇: ajax跨域时使得后台的sessioni