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: Regarding left outer join
PostPosted: Wed Aug 16, 2006 4:34 am 
Beginner
Beginner

Joined: Thu Jul 13, 2006 10:39 am
Posts: 23
Hi all,

How will I use left outer join in Hibernate?

I have one sample sql query

String sqlQuery="select ele.*,sub.submission_no,stu.*"
+" from element_data ele, submission sub,study_data stu"
+" where ele.submission_id=sub.submission_id"
+" and ele.study_id=stu.study_id(+)"
+" and ele.submission_id IN (select submission_id"
+" from submission s,application a"
+" where s.application_id=a.application_id "
+" and a.application_name='"+application_name+"' )";

Could anyoone give me sample hql query using left outer join for the
same.

Regards,
Sreekanth


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 8:39 am 
Regular
Regular

Joined: Wed May 05, 2004 3:41 pm
Posts: 118
Location: New Jersey,USA
I beleive the following query should give you the same equivalent:

Code:
select ele,sub.submission_no,stu
from element_data ele
inner join ele.submissions as sub
left outer join ele.studyData as stu
where sub.submissionId in(
select submission_id
from submission s
inner join s.application as a
where a.application_name=:applicationName
)


Top
 Profile  
 
 Post subject: Regarding left outer join
PostPosted: Wed Aug 16, 2006 8:43 am 
Beginner
Beginner

Joined: Thu Jul 13, 2006 10:39 am
Posts: 23
Hi,

Thank u for your valuable information. I tested the same query and itis working fine.

Once again thanks for your assistance.


Regards,
Sreekanth


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 9:01 am 
Regular
Regular

Joined: Wed May 05, 2004 3:41 pm
Posts: 118
Location: New Jersey,USA
Chapter n HWL explains in detail.

Anand
PS:Don't forget to Rate.


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.