//设置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; } }); //在转换的时候加个config JSONArray jsarr = JSONArray.fromObject(streetList,config); request.setAttribute("jsarr", jsarr); }
这个异常,是由于,json在转换数据的时候,能够检测出要转换的属性之间存在着主外键关系,特别是hibernate在操作数据的时候,造成了死循环,解决办法,就是用JsonConfig提供的一个过滤属性的方法,实现里面的apply的方法,然后将要过滤的属性进行判断。这样就可以解决这个问题了。
相关推荐
如果需要解析的数据间存在级联关系,而互相嵌套引用,在hibernate中极容易嵌套而抛出net.sf.json.JSONException: There is a cycle in the hierarchy异常。
并且对Dao和Service进行了封装,内含.jar包,并且解决了一对多双向关联的could not initialize proxy - no Session错误,同时解决了……invoked on net.sf.json.JSONException: There is a cycle in the hierarchy!...
### SAP BW Hierarchy Extractor:从SAP R3系统抽取自定义层级至BW系统的架构 #### 业务场景 在很多企业环境中,管理者需要能够访问其下属员工所负责的数据。尽管SAP Business Warehouse (BW)提供了丰富的业务内容...
解决这个启动 View Hierarchy时的这个bug: hierarchy viewer unable to debug device
Memory Hierarchy is a design strategy implemented to bridge the gap between the Central Processing Unit (CPU) and the various types of memory, which have differing speed, capacity, and cost ...
Test of consistency is critical for the AHP methodology. When a pairwise comparison matrix (PCM) fails the consistency test, the decision maker (DM) needs to make revisions. The state of the art ...
To develop a solid understanding of a data structure requires three things: First, you must learn how the information is arranged in the memory of the computer. Second, you must become familiar with ...
1. **`OPENJSON` 函数**:用于将 JSON 数据转换为表格形式。 2. **`FOR JSON` 子句**:用于将查询结果格式化为 JSON 输出。 3. **`JSON_VALUE` 和 `JSON_QUERY` 函数**:用于从 JSON 数据中提取特定值或子文档。 ...
sql server 2014 JSON解析到表函数 CREATE FUNCTION [dbo].[parseJSON]( @JSON NVARCHAR(MAX)) RETURNS @hierarchy TABLE ( element_id INT IDENTITY(1, 1) NOT NULL, ...
the best way to understand how computers work is to build one from scratch, and this textbook leads students through twelve chapters and projects that gradually build a basic hardware platform and a ...
* updated a polygon object: now the polygon toolbar is displayed not near to the object, but in the main toolbar and in ribbon; polygon modes are changed, new modes allow editing and adding curves > ...
它们允许不同系统之间进行数据交换,实现应用程序间的互操作性。常见的Web服务标准有SOAP(Simple Object Access Protocol)和REST(Representational State Transfer)。 Apache CXF是一个流行的开源框架,它用于...
Even when the actual handling differs, there is still some commonality. Hierarchical state machine design captures the commonality by organizing the states as a hierarchy. The states at the higher ...
在前端开发领域,数据可视化是一项重要的技能,它能够将复杂的数据转化为直观的图形,帮助用户理解和分析信息。在这个名为“前端项目-d3-hierarchy.zip”的压缩包中,包含了一个使用D3.js库实现的层次数据可视化布局...
An intent lock indicates that SQL Server wants to acquire a shared (S) lock or exclusive (X) lock on some of the resources lower down in the hierarchy. For example, a shared intent lock placed at the ...
在Unity游戏引擎中,"Hierarchy面板管理插件"是用来增强Unity内置Hierarchy面板功能的重要工具,目的是提高场景管理和编辑效率。本压缩包包含了两个这样的插件:Hierarchy PRO和QHierarchy。 Hierarchy PRO是一个...