我試圖做到以下幾點:可以一個List <>被轉換爲DataModel的
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();
}
不過我老覺得厚望:
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)
誰能舉個手嗎? 非常感謝你
對於我來說,這段代碼對於將'List <>'轉換爲'DataModel'工作正常。 – John 2016-04-19 11:14:08