| Author |
Possible to create this HQL equivalent using Hibernate Criteria?
|
James Cheng
Greenhorn
Joined: Mar 09, 2008
Posts: 1
|
|
I have two following classes mapped in hibernate mappings Class A1 { long ID; String t1; String t2; } Class B1 { long ID; String t3; String t4; } I am wondering if it's possible to create a HQL equivalent using criteria API SELECT {a.*} FROM A1 AS a, B1 AS b WHERE a.t1 = b.t3 AND a.t2 = b.t4 I looked up "correlated subqueries" but I can't seem to figure out a correct way to do this as A1 and B1 are not linked by any FK constraints. [ March 09, 2008: Message edited by: James Cheng ]
|
 |
Ravi Kakani
Greenhorn
Joined: Mar 10, 2008
Posts: 2
|
|
Hibernate doesn't support outer joins on dynamic associations (not presented in mapping). Look at Hibernate 3.1 - it is introduced new 'with' keyword: You may supply extra join conditions using the HQL with keyword. Hope this helps!
|
 |
Allen Yu
Greenhorn
Joined: May 07, 2006
Posts: 1
|
|
|
Thanks for the reply but what I need is to build such HQL using criteria, the HQL example works fine. I just want to create it using Criteria interface because I need to use this as a subquery for another Criteria.
|
 |
 |
|
|
subject: Possible to create this HQL equivalent using Hibernate Criteria?
|
|
|