9.2. Limitations

Il y a certaines limitations à l'approche du "polymorphisme implicite" pour la stratégie de mapping d'une table par classe concrète. Il y a plutôt moins de limitations restrictives aux mappings <union-subclass>.

La table suivante montre les limitations des mappings d'une table par classe concrète, et du polymorphisme implicite, dans Hibernate.

Tableau 9.1. Caractéristiques du mapping d'héritage

Stratégie d'héritage many-to-one polymorphique one-to-one polymorphique one-to-many polymorphique many-to-many polymorphique Polymorphic load()/get() Requêtes polymorphiques Jointures polymorphiques Récupération par jointure externe
une table par hiérarchie de classe <many-to-one> <one-to-one> <one-to-many> <many-to-many> s.get(Payment.class, id) from Payment p from Order o join o.payment p supportée
table per subclass <many-to-one> <one-to-one> <one-to-many> <many-to-many> s.get(Payment.class, id) from Payment p from Order o join o.payment p supportée
une table par classe concrète (union-subclass) <many-to-one> <one-to-one> <one-to-many> (for inverse="true" only) <many-to-many> s.get(Payment.class, id) from Payment p from Order o join o.payment p supportée
une table par classe concrète (polymorphisme implicite) <any> not supported not supported <many-to-any> s.createCriteria(Payment.class).add( Restrictions.idEq(id) ).uniqueResult() from Payment p not supported not supported