Hi all,
I'm getting in trouble while executing a simple query. I have an Entity named "Project", and a Session named ProjectServiceBean that implements ProjectService interface.
So the ProjectService (remote interface) gives me a method like this:
public Project findByName(String name) throws RemoteException { return (Project)entityManager.createQuery("from Project p where p.name = name").getSingleResult(); }
public Collection <Project> findByName(String name) throws RemoteException {
Collection <Project> result = entityManager.createQuery("from Project p where p.name = name").getResultList();
return result;
}
public Project findByName(String name) throws RemoteException { return (Project)entityManager.createQuery("from Project p where p.name = '" + name + "'").getSingleResult(); }
public Project findByName(String name) throws RemoteException { return (Project)entityManager.createQuery("from Project p where p.name =:name"). setParameter("name", name). getSingleResult(); }