I am a Hibernate newbie, and trying to see whether it is possible to use Criteria projections to return a collection of one-to-many associated objects, and cannot get the data. My entity mapping is like below:
Class A <n----1> Class B <1----n> Class C
I am using
Criteria criteria = createCriteria(A.class).
.createAlias("B", "B")
.createAlias("B.C", "C")
.setProjection(Projections.projectionList().
.add(Projections.property("B.f1")
.add(Projections.Property("B.C");
List<Object[]>rows = criteria.list();
I am expecitng the rows[*].[0] is f1 value, and rows[*].[1] is List<C>, a collection of C objects. But I cannot get back any rows[*].[1].
Any suggestions?
Thanks.
|