-->
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: HQL left join
PostPosted: Wed May 02, 2007 6:49 am 
Newbie

Joined: Wed May 02, 2007 6:37 am
Posts: 6
Hi,

I am relatively new to HQL and I am having problems with converting an sql query to hql.

Code:
FROM    t1 AS t1       
LEFT JOIN t2 AS t2 ON t1.xxx = t2.yyy where .....


Any help would be great

Thanks


Top
 Profile  
 
 Post subject: map it
PostPosted: Wed May 02, 2007 7:20 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
You just have to map the relation and then you can use:
Code:
from T1 left outer join t1.xxx  as t2

_________________
Edwin van der Elst
Finalist IT Group


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 7:28 am 
Newbie

Joined: Wed May 02, 2007 6:37 am
Posts: 6
so in my hbm mapping i need to declare a relationship between the tables only?


Top
 Profile  
 
 Post subject: sort of
PostPosted: Wed May 02, 2007 7:33 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
Something like this:

Code:
<class name="T1" table="t1">
    <id ...>
   <many-to-one name="xxx" class="T2">
</class>

<class name="T2" table="t2">
  <id name="yyy"/>
   ...
</class>


I recommend to read a little about mapping relations (in the reference docs)

_________________
Edwin van der Elst
Finalist IT Group


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.