views:

110

answers:

1

Hey,

Say I have 3 classes

class foo1 { List<foo2> 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.

A: 

Hey,

I'm having a similar sort of a requirement.. is it possible to do something like this or am i wasting my time. as of now I am retrieving all of these 1 by 1 from the db which is totally unnecessary and time consuming. My appln spends around 30% of its time in one of these repository calls..

Rahul