Register / Login
Win a copy of
Functional Reactive Programming
this week in the
Object Relational Mapping
Correlated subqueries in HQL Select Clause
Amandeep Singh Khurpal
posted 4 years ago
I am Trying use correlated Queries in HQL (in select clause) for the first time and i am having the problem, Please help
My HQL Query is of type
SELECT CMP.id ,CMP.Name, CMP.startDate, CMP.endDate, CMPTTL.impr, CMPTTL.cnImpr, (CMPTU.id.login FROM Z CMPTU WHERE CMPTU.id.cId=CMP.id AND CMPTU.id.login = 'email@example.com') FROM X CMP, Y CMPTTL WHERE CMP.Status = 'L' AND CMP.id = CMPTTL.Id (+)
As per the Hibernate Documentation "HQL subqueries can occur only in the select or where clauses.Even correlated subqueries (subqueries that refer to an alias in the outer query) are allowed. "
But when i execute my HQl I have this Error
"org.hibernate.QueryException: aggregate function expected before ( in SELECT"
I have seen the selectParser of hibernate and it expects a Aggregate function whenever "(" is encountered
Thanks in Advance
Possible to create this HQL equivalent using Hibernate Criteria?
SQL to HQL (Having issue in Left Outer Join)
How to use IN clause in HQL?
ClassicQueryTranslatorFactory & Custom Functions Doesn't work?
How to use IN Clause in HQL