LazyInitializationException with CDI Managed Bean and Stateful Session Bean

不羁的心 提交于 2019-12-01 19:36:50

Well, I finally solved the problem! I saw the LazyInitializationException was in the validation phase of the selectManyCheckbox. Then I started search for this and found this link: http://old.nabble.com/-jira---Created--(MYFACES-3306)-%3Ch%3AselectManyCheckBox%3E-%2B-JPA-with-Hibernate-creates-Hibernate-PersistentCollection-where-it-should-not.-Causes-td32463262.html

The problem was that the JSF was trying to use the PersistentBag created by the Hibernate, but it wouldn't use it. The solution was put a atributte telling the JSF to use a ArrayList instead of the PersistentBag.

It can be done by adding this inside the selectManyCheckbox:

<f:attribute name="collectionType" value="java.util.ArrayList" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!