hibernate报错 net.sf.json.util.CycleDetectionStrategy$StrictionStrategyRepeatedReferenceAsObject
生活随笔
收集整理的這篇文章主要介紹了
hibernate报错 net.sf.json.util.CycleDetectionStrategy$StrictionStrategyRepeatedReferenceAsObject
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
=執(zhí)行{+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)
原因是:在級(jí)聯(lián)查詢時(shí)json轉(zhuǎn)換級(jí)聯(lián)對(duì)象,,自關(guān)聯(lián)然后死循環(huán)報(bào)錯(cuò)
解決辦法:
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位技術(shù)專家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的hibernate报错 net.sf.json.util.CycleDetectionStrategy$StrictionStrategyRepeatedReferenceAsObject的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Java批量完成对文件夹下全部的css与
- 下一篇: ajax跨域时使得后台的sessioni