Get the App
SLTechnology News&Howtos  ›  Servers  › 

What if the foreground page cannot get the json object when the fromObject method is executed in Hiberna

Shulou Source: shulou.com Published: 2022-05-31 20:03:29 10月04日 Update

Today, I will talk to you about the implementation of the fromObject method in Hiberna when the foreground page can not get the json object, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Map map=new HashMap (); if (orderless null) {order.setGoodList (null); order.setOdate (null);} if (goodListworthy null) {for (Goods g:goodList) {g.setOrderList (null) }} map.put ("order", order); map.put ("goodList", goodList); System.out.println (order.getOid ()); System.out.println (order.toString ()); JSONObject json = JSONObject.fromObject (map); response.setCharacterEncoding ("utf-8") Response.getWriter () .write (json.toString ()

The above is a way to solve the endless loop, of course, jackson is the best way to deal with it!

The appearance of an endless loop is that it cannot execute to the next line of fromObject

The solution is:

It could be an endless loop or a missing jar package (json requires six jar packages). If it is an endless loop, the object that causes the loop (usually of type List or Set) is set to null.

The fromObject method also has a weak handling of date-type data, either registering a date processor or setting the date to null.

MyEclipse's generated toString methods for entity classes can lead to an endless loop for reasons similar to the fromObject method.

After reading the above, do you have any further understanding of what to do if the foreground page cannot get the json object when the fromObject method is executed in Hiberna? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Method loop object content date type processing foreground page method how to do line above have reason processor entity that is data more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Information MySQL NVidia Redmi