Hibernate中防止在查询是类中对象级联时的死循环

voteSubject= all.GetVoteSubjectById(vsId);//获取对象数据
         JsonConfig jc=new JsonConfig();
            //设置属性不能转换
            jc.setExcludes(new String[]{"不可以转换的属性之一","不可以转换的属性之级联对象的属性"});
            jc.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
         this.root = JSONObject.fromObject(voteSubject,jc);
         System.out.println(root);

猜你喜欢

转载自1049097489.iteye.com/blog/2309352