Adnotacja Hibernate Polymorphism.EXPLICIT nie działa?
Wiem, że jest o tym jakiś post, ale są około roku i nie ma odpowiedzi. Właściwie używamy Hibernate 4.2.1.Final nad PostgreSQL 8.4. Mamy dwie takie jednostki
Podmiot A (najwyższa klasa hierarchii)
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Polymorphism(type = PolymorphismType.EXPLICIT)
public class A {
@Id
@GeneratedValue
private Long id;
public A() {
}
public A(Long id) {
super();
this.id = id;
}
// Setters, getteres, hashCode and equals
}
Podmiot B (podklasa)
@Entity
public class B extends A{
String value;
public B(){
}
public B(String value) {
super();
this.value = value;
}
public B(Long id, String value) {
super(id);
this.value = value;
}
// Setters, getteres, hashCode and equals
}
Jak widać, obiekt jest opatrzony komentarzemPolymorphismType.EXPLICIT
ale przy pobieraniu najwyższej klasy za pomocą
ArrayList<A> lista = (ArrayList<A>) session.createCriteria(A.class).list();
dostajemy także podklasy B zString value
własność. W rzeczywistości instrukcja SQL zawieraleft outer join B
. Czy to nadal błąd w czwartej wersji Hibernate'a?
Z poważaniem