[jboss-user] [EJB 3.0] - Query returns Object instead of the right type....

dimar1975 do-not-reply at jboss.com
Wed Mar 11 13:00:46 EDT 2009


Hi all !
I have a query which worked fine until now:

Query dbQuery = em.createQuery("SELECT OBJECT(a) FROM TaskList AS a");	
  | List <TaskList> list = dbQuery .getResultList();

Now I need to change the query, just to restrict the query to a few fields from the TaskList:

Query dbQuery = em.createQuery("SELECT taskId,taskName FROM TaskList AS a");	
  | List <TaskList> list = dbQuery .getResultList();

The problem is that now the list contains Objects and not TaskList......I need TaskList otherwise I will have ClassCastExceptions in other pieces of the code......

is my syntax wrong or what else ?
Thanks a lot
marco


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4217073#4217073

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4217073



More information about the jboss-user mailing list