Skip to content

Commit 6969e64

Browse files
committed
add MetadataImpl.trim() to be called by Quarkus extension
Signed-off-by: Gavin King <gavin@hibernate.org>
1 parent a704341 commit 6969e64

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.regex.Pattern;
2121

2222
import org.hibernate.HibernateException;
23+
import org.hibernate.Internal;
2324
import org.hibernate.MappingException;
2425
import org.hibernate.SessionFactory;
2526
import org.hibernate.boot.SessionFactoryBuilder;
@@ -109,7 +110,6 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
109110
private final Map<String, SqmFunctionDescriptor> sqlFunctionMap;
110111
private final Database database;
111112

112-
// note that this "internal" constructor is called by the Quarkus extension!
113113
public MetadataImpl(
114114
UUID uuid,
115115
MetadataBuildingOptions metadataBuildingOptions,
@@ -680,4 +680,32 @@ public Map<Class<?>, Component> getGenericComponentsMap() {
680680
public Map<Class<?>, DiscriminatorType<?>> getEmbeddableDiscriminatorTypesMap() {
681681
return embeddableDiscriminatorTypesMap;
682682
}
683+
684+
@Internal
685+
// called by the Quarkus extension
686+
public MetadataImpl trim() {
687+
return new MetadataImpl(
688+
getUUID(),
689+
getMetadataBuildingOptions(), //TODO Replace this
690+
getEntityBindingMap(),
691+
getComposites(),
692+
getGenericComponentsMap(),
693+
getEmbeddableDiscriminatorTypesMap(),
694+
getMappedSuperclassMap(),
695+
getCollectionBindingMap(),
696+
getTypeDefinitionMap(),
697+
getFilterDefinitions(),
698+
getFetchProfileMap(),
699+
getImports(), // ok
700+
getIdGeneratorDefinitionMap(),
701+
getNamedQueryMap(),
702+
getNamedNativeQueryMap(), // TODO might contain references to org.hibernate.loader.custom.ConstructorResultColumnProcessor, org.hibernate.type.TypeStandardSQLFunction
703+
getNamedProcedureCallMap(),
704+
getSqlResultSetMappingMap(), //TODO might contain NativeSQLQueryReturn (as namedNativeQueryMap above)
705+
getNamedEntityGraphs(), //TODO reference to *annotation* instance ! FIXME or ignore feature?
706+
getSqlFunctionMap(), // ok
707+
getDatabase(), // Cleaned up: used to include references to MetadataBuildingOptions, etc.
708+
getBootstrapContext() //FIXME WHOA!
709+
);
710+
}
683711
}

0 commit comments

Comments
 (0)