-->
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.  [ 2 posts ] 
Author Message
 Post subject: how to write outer join in hibernate? plz tell me
PostPosted: Fri Jan 20, 2006 6:00 pm 
Newbie

Joined: Fri Jan 13, 2006 4:36 pm
Posts: 2
we were moving DAO's to hibernate ...
the SQL query which we were using previously is

select slc.firstName, slc.lastName, slc.status, slc.email,
d.state, slc.contactID from <table1> slc,
<tableD> d
where slc.addressID *= d.addressID and slc.status = 'Active' order by slc.lastName, slc.firstName

could any body plz tell me how to write the same in Hibernate?
and what to change in hibernate mapping file? etc...

Thanks in Advance,
vamshi


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 21, 2006 12:42 am 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
Your SQL is not an outer join, its just a plain inner join.

Write your Hibernate mappings in such a way you have a one-to-one (or) many-to-one mapping between "table1" and "tableD". When you write a HQL that links the table to its collection item, the SQL will be a joined one between the two tables.
Refer to
http://www.hibernate.org/hib_docs/v3/re ... yhql-joins


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.