Jsf validation error (shown by h:message) while updating Model, why?

Posted by Ignacio on Stack Overflow See other posts from Stack Overflow or by Ignacio
Published on 2010-06-14T17:20:12Z Indexed on 2010/06/14 17:22 UTC
Read the original article Hit count: 223

Filed under:
|
|

List.xhtml:

 <h:selectOneMenu value="#{produtosController.selected.codigo}">
    <f:selectItems value="#{produtosController.itemsAvailableSelectOne}"/>
 </h:selectOneMenu>
 <h:commandButton action="#{produtosController.createByCodigos}" value="Buscar" />  

Controller Class method:

 public String createByCodigos(){
    items = new ListDataModel(ejbFacade.findByCodigos(current.getCodigo()));
    updateCurrentItem();
    return "List";
}  

Facade Class method:

 public List<Produtos> findByCodigos(Integer codigo){
    Query q = em.createNamedQuery("Produtos.findByCodigo");
    q.setParameter("codigo", codigo);
    return q.getResultList();
}

Bean Class query:

 @NamedQuery(name = "Produtos.findByCodigo", query = "SELECT p FROM Produtos p WHERE p.codigo = :codigo")

 @Column(name = "codigo")
 private Integer codigo;

© Stack Overflow or respective owner

Related posts about jsf

Related posts about ejb