Hibernate people! Hello everyone!
I need something I think, it's really possible but I don't know if JPA/Hibernate can provide me.
I have this hierarchy:
Code:
Class A{}
Class B extends A{}
Class C extends A{}
I would like to query in table A but returning subclass objects as references, even if the subclass table (B or C) does not have records. This way:
Code:
List<A> list = session.findAll(A.class); // I need instances of B or C class. I can provide this type as a parameter.
for(A record : list){
B b = (B) record;
}
I would like this cast be possible.
Was I clear?
Thanks all!