JSON exception error while output using Struts 2

我只是一个虾纸丫 提交于 2019-12-04 16:56:48

The problem is that serialization to JSON happened when the Hibernate session is closed.

The entity might contain the properties mapped for lazy loading. They aren't loaded by default, such as collections and associations. If you want to load them you should do it while the session is open, such as use FetchType.EAGER or use Open Session In View implementation. Like it's already done in Full Hibernate Plugin.

Otherwise, you have to control the serialization via @JSON annotation and use json result type with parameters that allows including and excluding properties used by JSON result to serialize the object. More about this you can find in the documentation page for JSON Plugin.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!