I'm trying to map Generic types in Hibernate. I've searched and couldn't find clear answers how to do it. Help will be much appreciated. Here are some example classes:
public class Person {
...
}
public class PersonA extends Person {
...
}
public class PersonB extends Person {
...
}
public class PersonHolder<P extends Person> {
private P person;
...
}
public class People {
private Map<String, PersonHolder<PersonA> > aPeople;
private Map<String, PersonHolder<PersonB> > bPeople;
...
}
I'm using native Hibernate mapping (XML, no annotations). I already have Hibernate mapping for Person, PersonA and PersonB, but I would like to know if it's possible to map class PersonHolder's instantiation in a generic way without explicitly create generic-implementing sub-classes such as:
public class PersonAHolder extends PersonHolder<PersonA> {
...
}
(and mapping this class as an ordinary class).
Thanks!