Can anyone please tell me why the following isn't working?
<h:selectOneMenu value="#{modelosController.selected.idMarca}">
<br/>
<f:selectItems value="#{marcasController.itemsAvailableSelectOne}" />
<br/>
</h:selectOneMenu><br/>
<h:commandButton action="#{modelosController.createByMarcas}" value="Buscar" />
And the code:
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!