• Post Reply Bookmark Topic Watch Topic
  • New Topic

executing custom query with ejb3.0  RSS feed

 
akhil achuthan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to execute a query like the foll in ejb3.0..

SELECT s.severity as severity, count(*) as alarmcount FROM ALARMS a, SEVERITY s WHERE a.severityid=s.severityid group by s.severity


Since the result returned is not in the structure as any of the entity bean objects, I cannot use a named query. The createQuery() does not seem to work as well. It gives an error saying that "java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: ALARMS is not mapped"

Please anybody suggest what I can do with this type of query???
 
Rodrigo Lopes
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the method createNativeQuery(...) from the EntityManager
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!