Can a List<> be casted to a DataModel

Posted by Ignacio on Stack Overflow See other posts from Stack Overflow or by Ignacio
Published on 2010-06-12T04:39:55Z Indexed on 2010/06/12 4:42 UTC
Read the original article Hit count: 351

Filed under:
|
|

I'm trying to do the following:

public String createByMarcas() {
    items = (DataModel) ejbFacade.findByMarcas(current.getIdMarca().getId());
    updateCurrentItem();
    return "List";
}

public List<Modelos> findByMarcas(int idMarca){
    return em.createQuery("SELECT id, descripcion FROM Modelos WHERE id_marca ="+idMarca+"").getResultList();
}

But I keep getting this expection: Caused by: javax.ejb.EJBException at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5070) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:4968) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4756) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1906) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:198) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84) at $Proxy347.findByMarcas(Unknown Source) at controladores.EJB31_Generated_ModelosFacade_Intf_Bean_.findByMarcas(Unknown Source)

Can anyone give a hand please? Thank you very much

© Stack Overflow or respective owner

Related posts about jsf

Related posts about jpa