Ejb Update Model from selectOneMenu
- by Ignacio
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!