Hi,
I have a simple "named query" defined as follows
Code:
@NamedQuery(name="State.findAllSelectItems",
query="SELECT NEW org.ns.donor.helpers.StateQueryObject(s.id, s.stateName) " +
"FROM State s ORDER BY s.stateName")
When I try to create a TypedQuery for the above named query, it gives me following exception
Code:
Caused by: java.lang.IllegalArgumentException: Cannot create TypedQuery for query with more than one return
at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:510)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createNamedQuery(EntityManagerWrapper.java:555)
..............
Here is how I am creating the TypedQuery
Code:
TypedQuery query = em.createNamedQuery(namedQuery, c); //c is defined as Class c.
any ideas why I cannot create TypedQuery in above scenario.
regards,
Nirvan.