I am facing problem with hibernate's explicit polymorphism. I used the polymorphism annotation and set it to explicit, but with get() and collections in mapped classes i always get all subclasses. I see all subclasses with left join in the hibernate "show_sql" output. What's the problem? Do I understand the documentation wrong? Or is it a bug in hibernate 4? I haven't seen any example with hibernate 4 and polymorphism annotation.
sessionFactory.getCurrentSession().get(Node.class, 111); // return subclasses!
@Entity
@Table(name="Nodes")
@Inheritance(strategy = InheritanceType.JOINED)
@Polymorphism(type= PolymorphismType.EXPLICIT)
public class Node implements Serializable {
...
}
@Entity
@Table(name="Persons")
public class Person extends Node {
}
@Entity
@Table(name="Networks")
public class Network extends Node {
}
...and other subclasses...