Hello, I'm using Hibernate on JBoss 4.3.2 using standard JPA annotations. I have the following classes:
Code:
@Entity
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class A {
}
@Entity
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class B<T extends A> {
@OneToOne
private T foreing;
}
@Entity
public class A1 extends A {
}
@Entity
public class A2 extends A {
}
@Entity
public class B1 extends B<A1> {
}
@Entity
public class B2 extends B<A2> {
}
With this code, I expect to get a table B1 with a foreign key to A1 and B2 with a foreign key to A2 but instead I get two tables (B1 and B2) with foreign keys to A1. I don't know if I'm doing something wrong or if this cannot be implemented but I don't know why A1 is selected in both cases. The compiler is supposed to replace T with A1 and A2 in B1 and B2 respectively, isn't it? Then, why B2 is picking A1 instead of A2?