This content has been marked as final.
Show 3 replies
-
1. Re: Running SQL query instead of EJB QL
jamesjmp Apr 23, 2009 10:44 AM (in response to mike82)Hi!
I advise you to use a native query. For example:String sql ="...your SQL query..."; Query sqlQuery = entityManager.createNativeQuery(sql,Data.class); List<Data> dataList = sqlQuery.getResultList();
Hope it helps you!
-
2. Re: Running SQL query instead of EJB QL
mike82 Apr 23, 2009 11:39 AM (in response to mike82)this is what I was looking for! thanks a lot. I just changed it so I don't specify class of the results and take it from Object[] when iterating throught the results list. -
3. Re: Running SQL query instead of EJB QL
jamesjmp Apr 23, 2009 12:35 PM (in response to mike82)That´s ok as well, I forgot to say you that it is not compulsory to specify a data class. So this
Query sqlQuery = entityManager.createNativeQuery(sql);
works fine.