How to avoid LazyInitializationException when using ManyToMany as value for primefaces selectCheckboxMenu
The idea is to let the component know the type of data source collection. Sample code: <p:selectCheckboxMenu value="#{obj.studen...
https://www.czetsuyatech.com/2016/09/jsf-avoid-lazy-exception-select-checkbox-menu.html
The idea is to let the component know the type of data source collection.
Sample code:
Where elements is a list of students.
Sample code:
<p:selectCheckboxMenu value="#{obj.students}" filter="true" filterMatchMode="startsWith"> <f:attribute name="collectionType" value="java.util.ArrayList" /> <f:selectItems value="#{elements}" var="elem" itemLabel="#{elem[valueLabelField]}" itemValue="#{elem}" /> </p:selectCheckboxMenu>
Where elements is a list of students.
Post a Comment