I am new to SEAM trying out from a generated app some changes. Like implementing a data SelectOneMenu where I can show data from a table in a form.
I am getting the following exception
java.util.ArrayList cannot be cast to javax.faces.model.DataModel
It may be something very basic but I haven't found any good examples. Maybe someone can point one out to me. I am reading Seam in Action and Seam Framework from YUAN, havent found an example like the one I am trying.
This is my bean
@Name("FuncionesAcciones")
public class FuncionesAcciones {
@Logger
private Log log;
@In
StatusMessages statusMessages;
@In
protected EntityManager entityManager = null;
@DataModelSelection
@Out(required = false)
protected Usuarios selectedUser;
@DataModel
@Out(required = false)
protected List<Usuarios> listaUsers = null;
public String view() {
return "/AccionesEdit.xhtml";
}
@Factory("listaUsers")
public void listarUsuarios() {
List resultList = entityManager.createQuery(
"select idUsuarios from Usuarios")
.getResultList();
listaUsers = (List<Usuarios>) resultList;
// "select idUsuarios,NombreUsuario from Usuarios")
}
public void funcionesAcciones() {
// implement your business logic here
log.info("FuncionesAcciones.funcionesAcciones() action called");
statusMessages.add("funcionesAcciones");
}
// add additional action methods
}
This is the part where I use it in the Facelet
<s:decorate id="usuariosIdUsuariosField" value="#{FuncionesAcciones.selectedUser}" template="layout/edit.xhtml">
<ui:define name="label">Usuario que Identifica Accion</ui:define>
<h:selectOneMenu name="usuario" id="usuariosIdUsuarios" required="true" value="Usuarios.nombreUsuario">
<f:selectItems var="_usuario" value ="#{listaUsers}" label="#{_usuario.NombreUsuario}"/>
<s:convertEnum/>
</h:selectOneMenu>
</s:decorate>
Can someone point me in the right direction. Like I said I am new to SEAM, and somewhat average experience in JAVA/Hibernate. I come from PHP so the learning curve is apparently very hard right now as a beginner.