From cc3e4c82d3126b9c10e70b5b6ef73e0f531cba5d Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Fri, 17 Aug 2018 20:03:39 +0100 Subject: [PATCH] HHH-13209 Expose more state from MetadataImpl to allow shallow copies --- .../hibernate/boot/internal/MetadataImpl.java | 57 ++++++++++++++++++- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java index 85f78d01f4..eaa0cd5119 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java @@ -63,7 +63,7 @@ public class MetadataImpl implements MetadataImplementor, Serializable { private final MetadataBuildingOptions metadataBuildingOptions; private final BootstrapContext bootstrapContext; - private final IdentifierGeneratorFactory identifierGeneratorFactory; + private final MutableIdentifierGeneratorFactory identifierGeneratorFactory; private final Map entityBindingMap; private final Map mappedSuperclassMap; @@ -81,7 +81,7 @@ public class MetadataImpl implements MetadataImplementor, Serializable { private final Map sqlFunctionMap; private final Database database; - MetadataImpl( + public MetadataImpl( UUID uuid, MetadataBuildingOptions metadataBuildingOptions, MutableIdentifierGeneratorFactory identifierGeneratorFactory, @@ -195,7 +195,7 @@ public class MetadataImpl implements MetadataImplementor, Serializable { } @Override - public IdentifierGeneratorFactory getIdentifierGeneratorFactory() { + public MutableIdentifierGeneratorFactory getIdentifierGeneratorFactory() { return identifierGeneratorFactory; } @@ -391,4 +391,55 @@ public class MetadataImpl implements MetadataImplementor, Serializable { } return prop.getType(); } + + //Specific for copies only: + + public Map getEntityBindingMap() { + return entityBindingMap; + } + + public Map getCollectionBindingMap() { + return collectionBindingMap; + } + + public Map getTypeDefinitionMap() { + return typeDefinitionMap; + } + + public Map getFetchProfileMap() { + return fetchProfileMap; + } + + public Map getMappedSuperclassMap() { + return mappedSuperclassMap; + } + + public Map getIdGeneratorDefinitionMap() { + return idGeneratorDefinitionMap; + } + + public Map getNamedQueryMap() { + return namedQueryMap; + } + + public Map getNamedNativeQueryMap() { + return namedNativeQueryMap; + } + + public Map getNamedProcedureCallMap() { + return namedProcedureCallMap; + } + + public Map getSqlResultSetMappingMap() { + return sqlResultSetMappingMap; + } + + public Map getNamedEntityGraphMap() { + return namedEntityGraphMap; + } + + public BootstrapContext getBootstrapContext() { + return bootstrapContext; + } + }