After lots of testing, trying to get Java parameterisation working with an abstract parent (Single-table inheritance), and an abstract child table (one-table-per-class inheritance), I've given up.
It may be possible, but often you get problems where Hibernate tries to instantiate an abstract (parameterised) class as an entity. this is when you get the error "A has an unbound type and no explicit target entity."
It means Hibernate doesn't have a parameter value for a parameterised type.
I found that tests for the extending classes were fine, but tests around parent entities would break.
I would suggest rewriting it using the JPA inheritance, moving the parameterised stuff down into extending classes. That way you get the same polymorphism back from the database.
@MappedSuperclass
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "CLASS_TYPE", discriminatorType = DiscriminatorType.STRING)
public abstract class ClassA {
[...]
}
extension B:
@Entity
@DiscriminatorValue=("B")
public class ClassB extends ClassA {
@OneToOne
@JoinColumn(name = "mycolumn_id")
private Integer instance;
[...]
}
extension C:
@Entity
@DiscriminatorValue=("C")
public class ClassC extends ClassA {
@OneToOne
@JoinColumn(name = "mycolumn_id")
private String instance;
[...]
}