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???
posted 8 years ago
use the method createNativeQuery(...) from the EntityManager