Hi, The first part is HOW TO PROJECT COLLECTIONS?
Can We apply projections on collection elements? For e.g
class User{
private address List<Address>;
}
class Address{
private String city;
private String state;
}
Now can I just load the address attribute of User class? Using code like :
criteria.setProjection(Projections.property("Address"));
But it always return me null, even when the object does have an address field set. Is there any different way to project Collection Items??
THE SECOND PART : NESTED PROJECTIONS. Consider the same model as shown above, but instead of having a collection of Address, there is an single element. Now What if I want to just load the "city" attribute of Address which is an part of User class??
I tried doing :
Projections.property("Address.City")
But it gives me error, stating could not resolve property: "Address.City" of User.
Is there any provision for Projecting Collection elements and Nested Projections??