Search within Object Relational Mapping
Register / Login
Win a copy of
Mastering Corda: Blockchain for Java Developers
this week in the
this forum made possible by our volunteer staff, including ...
Stephan van Hulst
Object Relational Mapping
Correlated subqueries in HQL Select Clause
Amandeep Singh Khurpal
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
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
Boost this thread!
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