Hibernate Polymorphism.EXPLICIT anotación no funciona?
Sé que hay alguna publicación sobre esto, pero son alrededor de un año y no hay respuesta. Actualmente estamos utilizando Hibernate 4.2.1.Final sobre PostgreSQL 8.4. Tenemos dos entidades como esta
Entidad A (clase de jerarquía superior)
@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
}
Entidad B (Subclase)
@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
}
Como se puede ver, una entidad está anotada conPolymorphismType.EXPLICIT
pero al ir a la clase superior con
ArrayList<A> lista = (ArrayList<A>) session.createCriteria(A.class).list();
Estamos obteniendo las subclases B también con laString value
propiedad. De hecho, la sentencia SQL contieneleft outer join B
. ¿Sigue siendo un error en la cuarta versión de Hibernate o estoy haciendo algo mal?
Atentamente