I know there are some post about this, but they are about a year and no response. Actually we are using Hibernate 4.2.1.Final over PostgreSQL 8.4. We have two entitys like this
Entity A (Top Hierarchy Class)
@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
}
Entity B (Subclass)
@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
}
As you can see, A entity is annotated with PolymorphismType.EXPLICIT
but when fetching the top class with
ArrayList<A> lista = (ArrayList<A>) session.createCriteria(A.class).list();
we are getting the B subclasses too with the String value
property. In fact, the SQL statement contains left outer join B
. Is this still a bug in the fourth version of Hibernate or I'm doing something wrong?
Best regards