-->
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.  [ 1 post ] 
Author Message
 Post subject: HQL outer join
PostPosted: Thu Feb 15, 2007 2:50 pm 
Newbie

Joined: Mon Aug 07, 2006 7:14 pm
Posts: 16
[b]Hibernate version:3.1[/b]
Hello all.
I need to build a HQL query that performs an outer join between two non associates entities.
I just want to reproduce the following sql query in HQL:
select table_a.id as col_0,
table_b.score_1-table_a.score_1 as col_1,
table_b.score_2-table_a.score_2 as col_2,
table_b.score_3-table_a.score_3 as col_3,
table_b.score_4-table_a.score_4 as col_4
from p_audit as table_a left join p_audit as table_b on (table_a.join_id=table_b.join_id and table_b.filter_id=6)
where table_a.filter_id=1058
order by 2

As you can see this query performs an outer join in the same table (p_audit).
But I wasn't able to perform the same action in HQL.
I don't want to set an association one-to-one p_audit=>p_audit. Besides, in what property/column should I set the association?
I only need to perform a comparison query between two "snapshots" of the same entity, how could I do this with hibernate HQL?. I must do this in a single query, because I have to order the result set based in a comparison column.

Anybody know how could I perform this query? Is this possible in HQL?

Thanks in advance.


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

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.