HQL join after output of subquery
Posted
by user350374
on Stack Overflow
See other posts from Stack Overflow
or by user350374
Published on 2010-06-15T20:00:41Z
Indexed on
2010/06/15
20:02 UTC
Read the original article
Hit count: 273
Hey,
Say I have 3 classes
class foo1 { List prop1;}
class foo2 { foo3 prop2;}
class foo3{ int Id;}
now I want to select distinct foo2's from foo1 and get Id of foo3.
I need to write a HQL stmt for the same.
I tried the following
select c.Id from (select distinct(a.prop1) from foo1.prop1 as a ) as b inner join b.prop2 as c
This throws an 'Antlr.Runtime.NoViableAltException
How do you suggest I should go about the same. Please note the inner subquery is working fine. So if I have made some mistakes in there please ignore that.
I need a method to do the latter.
Thanks in Advance.
© Stack Overflow or respective owner