Hibernate version:3.0.5
If I want to select a collection property (cat.kittens) the following HQL query suffices.
Code:
select elements(cat.kittens) from eg.Cat cat
But how to do this using Critieria Queries?
I tried the following and it doesn't work
Code:
session.createCriteria(eg.Cat.class,"cat").createCriteria("cat.kittens", "kit")
.setProjection(
Projections.projectionList().add(Projections.property(cat.kittens))).list;
The resulting SQL is
Code:
select this_.id from CAT as this_ inner join CAT as kit_ on this_id = kit_.mother
which is seems to be wrong.
Is there any other way to write a criteria query to do this? Using 3.1beta helps?