LazyInitializationException with CDI Managed Bean and Stateful Session Bean

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" />