primefacesjsf-2.2omnifacesdeltaspike

Omnifaces <o:converter converterId="omnifaces.SelectItemsConverter"/> not working


I have a .war web app with PrimeFaces 6.2 + OmniFaces 2.6.9 + DeltaSpike JSF module 1.8.2. I have a p:selectOneMenu with omnifaces.SelectItemsConverter and the bean is deltaspike @ViewAccessScoped. The selectItems list is in the bean. I have the correct toString() implementation in the entity but The converter is not working it always gives the same exception

javax.faces.component.UpdateModelException: java.lang.IllegalArgumentException: Cannot convert 1 of type class java.lang.Integer to class ar.com.eden.semestre.entities.QaEstadosSemestres

Is omnifaces converter works with ViewAccessScope bean?

<p:selectOneMenu id="txtEstado" 
   requiredMessage="Debe ingresar un estado" 
   required="true" 
   value="#{semestreBean.semestre.estado}">
   <o:converter converterId="omnifaces.SelectItemsConverter"/> 
   <f:selectItem noSelectionOption="true" itemLabel="Seleccione un estado"/>
   <f:selectItems value="#{semestreBean.estadosLov}" var="e" itemLabel="#{e.nombre}" itemValue="#{e.id}"/> 
</p:selectOneMenu>
                       

What can be wrong? Thanks.


Solution

  • I have a mistake in the code, instead of returning the object i was returning the id in the itemValue property of the selectItems tag.