From 212d8c01e593f557de2f7b7303fb416b76f3b7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 3 Jul 2018 13:41:50 +0200 Subject: [PATCH] HHH-11495 Update the javadoc of Metamodel#getImplementors to reflect the actual implementation In particular, the actual implementations may not return all persisted subtypes if the given type is persisted and "explicit polymorphism" is enabled. So this really is more about HQL queries than about a class hierarchy. --- .../src/main/java/org/hibernate/Metamodel.java | 10 +++++++++- .../hibernate/metamodel/internal/MetamodelImpl.java | 11 ----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/Metamodel.java b/hibernate-core/src/main/java/org/hibernate/Metamodel.java index 137ec8b1ec..beb4e15f14 100644 --- a/hibernate-core/src/main/java/org/hibernate/Metamodel.java +++ b/hibernate-core/src/main/java/org/hibernate/Metamodel.java @@ -39,7 +39,15 @@ public interface Metamodel extends javax.persistence.metamodel.Metamodel { String getImportedClassName(String className); /** - * Get the names of all persistent classes that implement/extend the given interface/class + * Given the name of an entity class, determine all the class and interface names by which it can be + * referenced in an HQL query. + * + * @param entityName The name of the entity class + * + * @return the names of all persistent (mapped) classes that extend or implement the + * given class or interface, accounting for implicit/explicit polymorphism settings + * and excluding mapped subclasses/joined-subclasses of other classes in the result. + * @throws MappingException */ String[] getImplementors(String entityName); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetamodelImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetamodelImpl.java index 75d5557e7b..b3a3dc4b17 100755 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetamodelImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetamodelImpl.java @@ -614,17 +614,6 @@ public class MetamodelImpl implements MetamodelImplementor, Serializable { } } - /** - * Given the name of an entity class, determine all the class and interface names by which it can be - * referenced in an HQL query. - * - * @param className The name of the entity class - * - * @return the names of all persistent (mapped) classes that extend or implement the - * given class or interface, accounting for implicit/explicit polymorphism settings - * and excluding mapped subclasses/joined-subclasses of other classes in the result. - * @throws MappingException - */ @Override public String[] getImplementors(String className) throws MappingException { // computeIfAbsent() can be a contention point and we expect all the values to be in the map at some point so