-->
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: getting extra values in outer join
PostPosted: Wed Mar 16, 2005 3:28 pm 
Newbie

Joined: Wed Jan 05, 2005 1:29 pm
Posts: 1
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:[/b]
2.1

I have 2 related tables and the first table for the same selection criteria has more rows than the other. I would like to run an outer join in such a way that for the additional rows from the first table I would still see the result with the values from the second table as NULL. In isql I can simply move the match criteria from the "where" clause to the "from" clause. However, I can't figure out how to make Hibernate translate my HQL in such way.

My HQL:
"from LegalEntitySynonym as leSyn "+
"left join leSyn.legalEntity as le "+
"and leSyn.synonymType = ID' "+
"where le.legalEntityName like '%ELIGIBLE%' ";

gets translated in something like:
select .....
from legal_entity legalentit1_
left join legal_entity_synonym legalentit0_ on legalentit0_.legal_entity_id=legalentit1_.legal_entity_id
legalentit1_.legal_entity_id=accounts2_.legal_entity_id
where (legalentit1_.legal_entity_name like '%ELIGIBLE%' )
and (legalentit0_.synonym_type_code='ID' )

while I want it to be:

select .....
from legal_entity legalentit1_
left join legal_entity_synonym legalentit0_ on legalentit0_.legal_entity_id=legalentit1_.legal_entity_id
and (legalentit0_.synonym_type_code='ID' )
legalentit1_.legal_entity_id=accounts2_.legal_entity_id
where (legalentit1_.legal_entity_name like '%ELIGIBLE%' )

What can I do about it?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 16, 2005 4:00 pm 
Beginner
Beginner

Joined: Mon Mar 14, 2005 6:07 pm
Posts: 36
Welcome to the party - I posted the same question two days ago. I got two answers - one from this forum, the other from the forum in Russia. Here is the summary:
- It is not possible to add conditions to the "ON" portion of the join in Hibernate-2.
- If you must add conditions to the "ON" portion of the join, you have to switch to Hibernate-3 and use filters (I am in the process of verifying this - filters are new to me).
- The ability to add conditions to joins is a useful enhancement. It has ben logged several times, along with a more general request to allow joins without mapping a relation.
The enhancement logged for this is HHH-16 - I recommend you to vote for it on hibernate's JIRA page.


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.