Code:
public class Foo
{
..
private Foo1 foo1;
// maybe List listOfFoo1;
..
}
public class Foo1
{
...
private Foo2 foo2;
// maybe List listOfFoo2;
...
}
public class Foo2
{
...
private Foo2 foo3;
//maybe List listOfFoo3;
...
}
then in HQL you could write:
Code:
select foo from Foo foo
inner join foo.foo1 foo1
inner join foo1.foo2 foo2
inner join foo2.foo3 foo3
where foo3.service = "Y"
or even simpler:
Code:
select foo from Foo foo
where foo.foo1.foo2.foo3.service = "Y"
in the case when in Foo you have listOfFoo1
you should use:
Code:
inner join foo.listOfFoo1 listOfFoo1Element