LazyInitializationException in selectManyCheckbox on @ManyToMany(fetch=LAZY)

You need to fetch it while inside a transaction (thus, inside the service method), and not while outside a transaction (thus, inside e.g. JSF managed bean init/action method), that would thus throw a LazyInitializationException. So, your attempt hardware.getConnectivities().size(); has to take place inside a transaction. Create if necessary a new service method for the purpose … Read more

Collection of selectManyCheckbox inside a ui:repeat knows which element of the repeater it belongs to

Simplest way would be to just bind the value of the checkbox group to the currently iterated object instead of all checkbox groups to one and same parent bean property. In code, just replace value=”#{gridPopUpBean.oneQuestionUserAnswerList}” by value=”#{p.oneQuestionUserAnswerList}” and make changes in the model accordingly. Alternatively, you can also provide a Map of all answers by … Read more

UISelectMany on a List causes java.lang.ClassCastException: java.lang.String cannot be cast to T

Your problem is caused by the following facts: Java generics are compiletime syntactic sugar and completely absent during runtime. EL expressions runs during runtime and not during compiletime. HTTP request parameters are obtained as Strings. Logical consequence is: EL doesn’t see any generic type information. EL doesn’t see a List<Long>, but a List. So, when … Read more

Use enum in h:selectManyCheckbox

This problem is not specifically related to enums. You would have the same problem with other List types for which JSF has builtin converters, e.g. List<Integer>, List<Double>, etcetera. The problem is that EL operates runtime and that generic type information is lost during runtime. So in essence, JSF/EL doesn’t know anything about the parameterized type … Read more