Ejb Update Model from selectOneMenu
Posted
by Ignacio
on Stack Overflow
See other posts from Stack Overflow
or by Ignacio
Published on 2010-06-07T04:57:36Z
Indexed on
2010/06/07
5:02 UTC
Read the original article
Hit count: 321
Can anyone please tell me why the following isn't working?
h:selectOneMenu value="#{modelosController.selected.idMarca}">
f:selectItems value="#{marcasController.itemsAvailableSelectOne}" />
/h:selectOneMenu>
h:commandButton action="#{modelosController.createByMarcas}" value="Buscar" />
public String createByMarcas() {
current = new Modelos(selectedItemIndex, current.getIdMarca());
items =(DataModel)ejbFacade.findByMarcas();
getPagination().getItemsCount();
recreateModel();
return "List";
}
public List<Modelos> findByMarcas(){
CriteriaQuery cq = (CriteriaQuery) em.createNamedQuery("SELECT m FROM Modelos WHERE m.id_marca :id_marca");
cq.select(cq.from(Modelos.class));
return em.createQuery(cq).getResultList();
}
Thank you very much!
© Stack Overflow or respective owner