A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Badass: Making Users Awesome
this week in the
Object Relational Mapping
Correlated subqueries in HQL Select Clause
Amandeep Singh Khurpal
Joined: Feb 20, 2012
Feb 20, 2012 00:36:08
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
I agree. Here's the link:
subject: Correlated subqueries in HQL Select Clause
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
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015