[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.
|