Is it possible to dynamically specify (via the query) which parts of the object are populated .
eg. consider a class
Code:
public class Person {
long id;
String name;
String age;
List<Address> addresses;
List<Long> phoneNumbers;
Company company
}
Is there a way I can chose to populate ONLY one or more (as desired) fields in the query (sort of like dynamic lazy loading)? If I use projections or select Person.a, Person.b ... type syntax, I get a list of Object arrays (which is technically what I want), but I'd really like to be able to cast to a Person object in the query
I looked at projection lists and they are close but still end up with a list of Object arrays.
Thanks