-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Implementing RIGHT and LEFT OUTER JOIN using HQL
PostPosted: Sat Aug 23, 2008 1:37 pm 
Newbie

Joined: Sat Aug 23, 2008 1:30 pm
Posts: 4
Hi ,

I implemented JOIN using HQL. When i tried to use session.enablefilter...it didnt work .


Can someone tell me whether it is possible to use session.enablefilter on HQL join queries?

Is it possible to create join querieis using CRITERIA ...can someone give me a simple example ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 24, 2008 4:28 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I think filters are only applied to the root entity in the query. Eg. only the entity following the "from" part. For example:

Code:
from A a join a.b b


The filter is only applied to A, not B.


Top
 Profile  
 
 Post subject: Thanks for the reply
PostPosted: Sat Aug 30, 2008 8:52 am 
Newbie

Joined: Sat Aug 23, 2008 1:30 pm
Posts: 4
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 3:09 am 
Newbie

Joined: Tue Sep 02, 2008 2:44 am
Posts: 1
Location: Ukrain, Ivano-Frankivsk
Quote:
The filter is only applied to A, not B.


Can you tell me what to do if I want to filter B.
To make Hibernate generate something like this:
Code:
SELECT a.id, b.name
FROM table1 a LEFT JOIN table2 b ON (a.id = b.foreingId AND b.locale='EN');



Thanks.[/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.