add MetadataImpl.trim() to be called by Quarkus extension

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-08-14 14:43:37 -06:00
parent a7043419d4
commit 6969e64777
1 changed files with 29 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import java.util.function.Supplier;
import java.util.regex.Pattern;
import org.hibernate.HibernateException;
import org.hibernate.Internal;
import org.hibernate.MappingException;
import org.hibernate.SessionFactory;
import org.hibernate.boot.SessionFactoryBuilder;
@ -109,7 +110,6 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
private final Map<String, SqmFunctionDescriptor> sqlFunctionMap;
private final Database database;
// note that this "internal" constructor is called by the Quarkus extension!
public MetadataImpl(
UUID uuid,
MetadataBuildingOptions metadataBuildingOptions,
@ -680,4 +680,32 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
public Map<Class<?>, DiscriminatorType<?>> getEmbeddableDiscriminatorTypesMap() {
return embeddableDiscriminatorTypesMap;
}
@Internal
// called by the Quarkus extension
public MetadataImpl trim() {
return new MetadataImpl(
getUUID(),
getMetadataBuildingOptions(), //TODO Replace this
getEntityBindingMap(),
getComposites(),
getGenericComponentsMap(),
getEmbeddableDiscriminatorTypesMap(),
getMappedSuperclassMap(),
getCollectionBindingMap(),
getTypeDefinitionMap(),
getFilterDefinitions(),
getFetchProfileMap(),
getImports(), // ok
getIdGeneratorDefinitionMap(),
getNamedQueryMap(),
getNamedNativeQueryMap(), // TODO might contain references to org.hibernate.loader.custom.ConstructorResultColumnProcessor, org.hibernate.type.TypeStandardSQLFunction
getNamedProcedureCallMap(),
getSqlResultSetMappingMap(), //TODO might contain NativeSQLQueryReturn (as namedNativeQueryMap above)
getNamedEntityGraphs(), //TODO reference to *annotation* instance ! FIXME or ignore feature?
getSqlFunctionMap(), // ok
getDatabase(), // Cleaned up: used to include references to MetadataBuildingOptions, etc.
getBootstrapContext() //FIXME WHOA!
);
}
}