HHH-9899 Enable integrators to plug in custom MetadataBuilder and Metadata

This commit is contained in:
Gunnar Morling 2015-07-07 10:52:59 +02:00
parent 83f4d4b81d
commit 710e1f0288
8 changed files with 738 additions and 8 deletions

View File

@ -26,7 +26,6 @@ import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.type.BasicType;
import org.hibernate.usertype.CompositeUserType;
import org.hibernate.usertype.UserType;
import org.jboss.jandex.IndexView;
/**
@ -395,6 +394,15 @@ public interface MetadataBuilder {
// */
// public MetadataBuilder with(PersistentAttributeMemberResolver resolver);
/**
* Allows unwrapping this builder as another, more specific type.
*
* @param type
* @param <T>
*
* @return The unwrapped builder.
*/
public <T extends MetadataBuilder> T unwrap(Class<T> type);
/**
* Actually build the metamodel

View File

@ -19,8 +19,10 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
import javax.xml.transform.dom.DOMSource;
import org.hibernate.HibernateException;
import org.hibernate.boot.archive.spi.InputStreamAccess;
import org.hibernate.boot.internal.MetadataBuilderImpl;
import org.hibernate.boot.jaxb.Origin;
@ -32,12 +34,14 @@ import org.hibernate.boot.jaxb.spi.Binding;
import org.hibernate.boot.registry.BootstrapServiceRegistry;
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.spi.MetadataBuilderFactory;
import org.hibernate.boot.spi.XmlMappingBinderAccess;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.SerializationException;
import org.w3c.dom.Document;
/**
@ -118,7 +122,8 @@ public class MetadataSources implements Serializable {
* @return The built metadata.
*/
public MetadataBuilder getMetadataBuilder() {
return new MetadataBuilderImpl( this );
MetadataBuilderImpl defaultBuilder = new MetadataBuilderImpl( this );
return getCustomBuilderOrDefault( defaultBuilder );
}
/**
@ -127,7 +132,40 @@ public class MetadataSources implements Serializable {
* @return The built metadata.
*/
public MetadataBuilder getMetadataBuilder(StandardServiceRegistry serviceRegistry) {
return new MetadataBuilderImpl( this, serviceRegistry );
MetadataBuilderImpl defaultBuilder = new MetadataBuilderImpl( this, serviceRegistry );
return getCustomBuilderOrDefault( defaultBuilder );
}
/**
* In case a custom {@link MetadataBuilderFactory} creates a custom builder, return that one, otherwise the default
* builder.
*/
private MetadataBuilder getCustomBuilderOrDefault(MetadataBuilderImpl defaultBuilder) {
final ClassLoaderService cls = serviceRegistry.getService( ClassLoaderService.class );
final java.util.Collection<MetadataBuilderFactory> discoveredBuilderFactories = cls.loadJavaServices( MetadataBuilderFactory.class );
MetadataBuilder builder = null;
List<String> activeFactoryNames = null;
for ( MetadataBuilderFactory discoveredBuilderFactory : discoveredBuilderFactories ) {
final MetadataBuilder returnedBuilder = discoveredBuilderFactory.getMetadataBuilder( this, defaultBuilder );
if ( returnedBuilder != null ) {
if ( activeFactoryNames == null ) {
activeFactoryNames = new ArrayList<String>();
}
activeFactoryNames.add( discoveredBuilderFactory.getClass().getName() );
builder = returnedBuilder;
}
}
if ( activeFactoryNames != null && activeFactoryNames.size() > 1 ) {
throw new HibernateException(
"Multiple active MetadataBuilder definitions were discovered : " +
StringHelper.join( ", ", activeFactoryNames )
);
}
return builder != null ? builder : defaultBuilder;
}
/**

View File

@ -12,6 +12,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.AttributeConverter;
import javax.persistence.SharedCacheMode;
@ -74,7 +75,6 @@ import org.hibernate.type.CompositeCustomType;
import org.hibernate.type.CustomType;
import org.hibernate.usertype.CompositeUserType;
import org.hibernate.usertype.UserType;
import org.jboss.jandex.IndexView;
import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
@ -385,6 +385,12 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
// return this;
// }
@Override
@SuppressWarnings("unchecked")
public <T extends MetadataBuilder> T unwrap(Class<T> type) {
return (T) this;
}
@Override
public MetadataImplementor build() {
final CfgXmlAccessService cfgXmlAccessService = options.serviceRegistry.getService( CfgXmlAccessService.class );

View File

@ -53,7 +53,6 @@ import org.hibernate.resource.transaction.TransactionCoordinatorBuilder;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.tuple.entity.EntityTuplizerFactory;
import org.jboss.logging.Logger;
import static org.hibernate.cfg.AvailableSettings.AUTO_CLOSE_SESSION;
@ -78,6 +77,7 @@ import static org.hibernate.cfg.AvailableSettings.MAX_FETCH_DEPTH;
import static org.hibernate.cfg.AvailableSettings.MULTI_TENANT_IDENTIFIER_RESOLVER;
import static org.hibernate.cfg.AvailableSettings.ORDER_INSERTS;
import static org.hibernate.cfg.AvailableSettings.ORDER_UPDATES;
import static org.hibernate.cfg.AvailableSettings.PREFER_USER_TRANSACTION;
import static org.hibernate.cfg.AvailableSettings.QUERY_CACHE_FACTORY;
import static org.hibernate.cfg.AvailableSettings.QUERY_STARTUP_CHECKING;
import static org.hibernate.cfg.AvailableSettings.QUERY_SUBSTITUTIONS;
@ -98,7 +98,6 @@ import static org.hibernate.cfg.AvailableSettings.USE_SQL_COMMENTS;
import static org.hibernate.cfg.AvailableSettings.USE_STRUCTURED_CACHE;
import static org.hibernate.cfg.AvailableSettings.WRAP_RESULT_SETS;
import static org.hibernate.engine.config.spi.StandardConverters.BOOLEAN;
import static org.hibernate.cfg.AvailableSettings.PREFER_USER_TRANSACTION;
/**
* @author Gail Badner
@ -110,7 +109,7 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
private final MetadataImplementor metadata;
private final SessionFactoryOptionsStateStandardImpl options;
SessionFactoryBuilderImpl(MetadataImplementor metadata) {
public SessionFactoryBuilderImpl(MetadataImplementor metadata) {
this.metadata = metadata;
this.options = new SessionFactoryOptionsStateStandardImpl( metadata.getMetadataBuildingOptions().getServiceRegistry() );

View File

@ -0,0 +1,225 @@
/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.spi;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.hibernate.MappingException;
import org.hibernate.SessionFactory;
import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.boot.model.IdentifierGeneratorDefinition;
import org.hibernate.boot.model.TypeDefinition;
import org.hibernate.boot.model.relational.Database;
import org.hibernate.cfg.annotations.NamedEntityGraphDefinition;
import org.hibernate.cfg.annotations.NamedProcedureCallDefinition;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.engine.ResultSetMappingDefinition;
import org.hibernate.engine.spi.FilterDefinition;
import org.hibernate.engine.spi.NamedQueryDefinition;
import org.hibernate.engine.spi.NamedSQLQueryDefinition;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.internal.NamedQueryRepository;
import org.hibernate.internal.SessionFactoryImpl;
import org.hibernate.mapping.FetchProfile;
import org.hibernate.mapping.MappedSuperclass;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Table;
import org.hibernate.type.Type;
import org.hibernate.type.TypeResolver;
/**
* Convenience base class for custom implementors of {@link MetadataImplementor} using delegation.
*
* @author Gunnar Morling
*
*/
public abstract class AbstractDelegatingMetadata implements MetadataImplementor {
private final MetadataImplementor delegate;
public AbstractDelegatingMetadata(MetadataImplementor delegate) {
this.delegate = delegate;
}
@Override
public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
return delegate.getIdentifierGeneratorFactory();
}
@Override
public Type getIdentifierType(String className) throws MappingException {
return delegate.getIdentifierType( className );
}
@Override
public String getIdentifierPropertyName(String className) throws MappingException {
return delegate.getIdentifierPropertyName( className );
}
@Override
public Type getReferencedPropertyType(String className, String propertyName) throws MappingException {
return delegate.getReferencedPropertyType( className, propertyName );
}
@Override
public SessionFactoryBuilder getSessionFactoryBuilder() {
return delegate.getSessionFactoryBuilder();
}
@Override
public SessionFactory buildSessionFactory() {
return delegate.buildSessionFactory();
}
@Override
public UUID getUUID() {
return delegate.getUUID();
}
@Override
public Database getDatabase() {
return delegate.getDatabase();
}
@Override
public Collection<PersistentClass> getEntityBindings() {
return delegate.getEntityBindings();
}
@Override
public PersistentClass getEntityBinding(String entityName) {
return delegate.getEntityBinding( entityName );
}
@Override
public Collection<org.hibernate.mapping.Collection> getCollectionBindings() {
return delegate.getCollectionBindings();
}
@Override
public org.hibernate.mapping.Collection getCollectionBinding(String role) {
return delegate.getCollectionBinding( role );
}
@Override
public Map<String, String> getImports() {
return delegate.getImports();
}
@Override
public NamedQueryDefinition getNamedQueryDefinition(String name) {
return delegate.getNamedQueryDefinition( name );
}
@Override
public Collection<NamedQueryDefinition> getNamedQueryDefinitions() {
return delegate.getNamedQueryDefinitions();
}
@Override
public NamedSQLQueryDefinition getNamedNativeQueryDefinition(String name) {
return delegate.getNamedNativeQueryDefinition( name );
}
@Override
public Collection<NamedSQLQueryDefinition> getNamedNativeQueryDefinitions() {
return delegate.getNamedNativeQueryDefinitions();
}
@Override
public Collection<NamedProcedureCallDefinition> getNamedProcedureCallDefinitions() {
return delegate.getNamedProcedureCallDefinitions();
}
@Override
public ResultSetMappingDefinition getResultSetMapping(String name) {
return delegate.getResultSetMapping( name );
}
@Override
public Map<String, ResultSetMappingDefinition> getResultSetMappingDefinitions() {
return delegate.getResultSetMappingDefinitions();
}
@Override
public TypeDefinition getTypeDefinition(String typeName) {
return delegate.getTypeDefinition( typeName );
}
@Override
public Map<String, FilterDefinition> getFilterDefinitions() {
return delegate.getFilterDefinitions();
}
@Override
public FilterDefinition getFilterDefinition(String name) {
return delegate.getFilterDefinition( name );
}
@Override
public FetchProfile getFetchProfile(String name) {
return delegate.getFetchProfile( name );
}
@Override
public Collection<FetchProfile> getFetchProfiles() {
return delegate.getFetchProfiles();
}
@Override
public NamedEntityGraphDefinition getNamedEntityGraph(String name) {
return delegate.getNamedEntityGraph( name );
}
@Override
public Map<String, NamedEntityGraphDefinition> getNamedEntityGraphs() {
return delegate.getNamedEntityGraphs();
}
@Override
public IdentifierGeneratorDefinition getIdentifierGenerator(String name) {
return delegate.getIdentifierGenerator( name );
}
@Override
public Collection<Table> collectTableMappings() {
return delegate.collectTableMappings();
}
@Override
public Map<String, SQLFunction> getSqlFunctionMap() {
return delegate.getSqlFunctionMap();
}
@Override
public MetadataBuildingOptions getMetadataBuildingOptions() {
return delegate.getMetadataBuildingOptions();
}
@Override
public TypeResolver getTypeResolver() {
return delegate.getTypeResolver();
}
@Override
public NamedQueryRepository buildNamedQueryRepository(SessionFactoryImpl sessionFactory) {
return delegate.buildNamedQueryRepository( sessionFactory );
}
@Override
public void validate() throws MappingException {
delegate.validate();
}
@Override
public Set<MappedSuperclass> getMappedSuperclassMappingsCopy() {
return delegate.getMappedSuperclassMappingsCopy();
}
}

View File

@ -0,0 +1,251 @@
/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.spi;
import javax.persistence.AttributeConverter;
import javax.persistence.SharedCacheMode;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.boot.CacheRegionDefinition;
import org.hibernate.boot.MetadataBuilder;
import org.hibernate.boot.archive.scan.spi.ScanEnvironment;
import org.hibernate.boot.archive.scan.spi.ScanOptions;
import org.hibernate.boot.archive.scan.spi.Scanner;
import org.hibernate.boot.archive.spi.ArchiveDescriptorFactory;
import org.hibernate.boot.model.IdGeneratorStrategyInterpreter;
import org.hibernate.boot.model.TypeContributor;
import org.hibernate.boot.model.naming.ImplicitNamingStrategy;
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.AttributeConverterDefinition;
import org.hibernate.cfg.MetadataSourceType;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.type.BasicType;
import org.hibernate.usertype.CompositeUserType;
import org.hibernate.usertype.UserType;
import org.jboss.jandex.IndexView;
/**
* Convenience base class for custom implementors of {@link MetadataBuilderImplementor} using delegation.
*
* @author Gunnar Morling
*
* @param <T> The type of a specific sub-class; Allows sub-classes to narrow down the return-type of the contract methods
* to a specialization of {@link MetadataBuilderImplementor}
*/
public abstract class AbstractDelegatingMetadataBuilderImplementor<T extends AbstractDelegatingMetadataBuilderImplementor<T>> implements MetadataBuilderImplementor {
private final MetadataBuilderImplementor delegate;
public MetadataBuilderImplementor getDelegate() {
return delegate;
}
public AbstractDelegatingMetadataBuilderImplementor(MetadataBuilderImplementor delegate) {
this.delegate = delegate;
}
/**
* Returns a specific implementation. See the <a
* href="http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206">What is the
* "getThis trick?"</a>.
*/
protected abstract T getThis();
@Override
public MetadataBuilder applyImplicitSchemaName(String implicitSchemaName) {
delegate.applyImplicitSchemaName( implicitSchemaName );
return getThis();
}
@Override
public MetadataBuilder applyImplicitCatalogName(String implicitCatalogName) {
delegate.applyImplicitCatalogName( implicitCatalogName );
return getThis();
}
@Override
public MetadataBuilder applyImplicitNamingStrategy(ImplicitNamingStrategy namingStrategy) {
delegate.applyImplicitNamingStrategy( namingStrategy );
return getThis();
}
@Override
public MetadataBuilder applyPhysicalNamingStrategy(PhysicalNamingStrategy namingStrategy) {
delegate.applyPhysicalNamingStrategy( namingStrategy );
return getThis();
}
@Override
public MetadataBuilder applyReflectionManager(ReflectionManager reflectionManager) {
delegate.applyReflectionManager( reflectionManager );
return getThis();
}
@Override
public MetadataBuilder applySharedCacheMode(SharedCacheMode cacheMode) {
delegate.applySharedCacheMode( cacheMode );
return getThis();
}
@Override
public MetadataBuilder applyAccessType(AccessType accessType) {
delegate.applyAccessType( accessType );
return getThis();
}
@Override
public MetadataBuilder applyIndexView(IndexView jandexView) {
delegate.applyIndexView( jandexView );
return getThis();
}
@Override
public MetadataBuilder applyScanOptions(ScanOptions scanOptions) {
delegate.applyScanOptions( scanOptions );
return getThis();
}
@Override
public MetadataBuilder applyScanEnvironment(ScanEnvironment scanEnvironment) {
delegate.applyScanEnvironment( scanEnvironment );
return getThis();
}
@Override
public MetadataBuilder applyScanner(Scanner scanner) {
delegate.applyScanner( scanner );
return getThis();
}
@Override
public MetadataBuilder applyArchiveDescriptorFactory(ArchiveDescriptorFactory factory) {
delegate.applyArchiveDescriptorFactory( factory );
return getThis();
}
@Override
public MetadataBuilder enableNewIdentifierGeneratorSupport(boolean enable) {
delegate.enableNewIdentifierGeneratorSupport( enable );
return getThis();
}
@Override
public MetadataBuilder enableExplicitDiscriminatorsForJoinedSubclassSupport(boolean enabled) {
delegate.enableExplicitDiscriminatorsForJoinedSubclassSupport( enabled );
return getThis();
}
@Override
public MetadataBuilder enableImplicitDiscriminatorsForJoinedSubclassSupport(boolean enabled) {
delegate.enableImplicitDiscriminatorsForJoinedSubclassSupport( enabled );
return getThis();
}
@Override
public MetadataBuilder enableImplicitForcingOfDiscriminatorsInSelect(boolean supported) {
delegate.enableImplicitForcingOfDiscriminatorsInSelect( supported );
return getThis();
}
@Override
public MetadataBuilder enableGlobalNationalizedCharacterDataSupport(boolean enabled) {
delegate.enableGlobalNationalizedCharacterDataSupport( enabled );
return getThis();
}
@Override
public MetadataBuilder applyBasicType(BasicType type) {
delegate.applyBasicType( type );
return getThis();
}
@Override
public MetadataBuilder applyBasicType(UserType type, String[] keys) {
delegate.applyBasicType( type, keys );
return getThis();
}
@Override
public MetadataBuilder applyBasicType(CompositeUserType type, String[] keys) {
delegate.applyBasicType( type, keys );
return getThis();
}
@Override
public MetadataBuilder applyTypes(TypeContributor typeContributor) {
delegate.applyTypes( typeContributor );
return getThis();
}
@Override
public MetadataBuilder applyCacheRegionDefinition(CacheRegionDefinition cacheRegionDefinition) {
delegate.applyCacheRegionDefinition( cacheRegionDefinition );
return getThis();
}
@Override
public MetadataBuilder applyTempClassLoader(ClassLoader tempClassLoader) {
delegate.applyTempClassLoader( tempClassLoader );
return getThis();
}
@Override
public MetadataBuilder applySourceProcessOrdering(MetadataSourceType... sourceTypes) {
delegate.applySourceProcessOrdering( sourceTypes );
return getThis();
}
@Override
public MetadataBuilder applySqlFunction(String functionName, SQLFunction function) {
delegate.applySqlFunction( functionName, function );
return getThis();
}
@Override
public MetadataBuilder applyAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject) {
delegate.applyAuxiliaryDatabaseObject( auxiliaryDatabaseObject );
return getThis();
}
@Override
public MetadataBuilder applyAttributeConverter(AttributeConverterDefinition definition) {
delegate.applyAttributeConverter( definition );
return getThis();
}
@Override
public MetadataBuilder applyAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass) {
delegate.applyAttributeConverter( attributeConverterClass );
return getThis();
}
@Override
public MetadataBuilder applyAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply) {
delegate.applyAttributeConverter( attributeConverterClass, autoApply );
return getThis();
}
@Override
public MetadataBuilder applyAttributeConverter(AttributeConverter attributeConverter) {
delegate.applyAttributeConverter( attributeConverter );
return getThis();
}
@Override
public MetadataBuilder applyAttributeConverter(AttributeConverter attributeConverter, boolean autoApply) {
delegate.applyAttributeConverter( attributeConverter, autoApply );
return getThis();
}
@Override
public MetadataBuilder applyIdGenerationTypeInterpreter(IdGeneratorStrategyInterpreter interpreter) {
delegate.applyIdGenerationTypeInterpreter( interpreter );
return getThis();
}
}

View File

@ -0,0 +1,174 @@
/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.spi;
import java.util.List;
import java.util.Map;
import javax.persistence.SharedCacheMode;
import org.hibernate.MultiTenancyStrategy;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.boot.CacheRegionDefinition;
import org.hibernate.boot.archive.scan.spi.ScanEnvironment;
import org.hibernate.boot.archive.scan.spi.ScanOptions;
import org.hibernate.boot.archive.spi.ArchiveDescriptorFactory;
import org.hibernate.boot.model.IdGeneratorStrategyInterpreter;
import org.hibernate.boot.model.naming.ImplicitNamingStrategy;
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.AttributeConverterDefinition;
import org.hibernate.cfg.MetadataSourceType;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.type.BasicType;
import org.jboss.jandex.IndexView;
/**
* Convenience base class for custom implementors of {@link MetadataBuildingOptions} using delegation.
*
* @author Gunnar Morling
*/
public abstract class AbstractDelegatingMetadataBuildingOptions implements MetadataBuildingOptions {
private final MetadataBuildingOptions delegate;
public AbstractDelegatingMetadataBuildingOptions(MetadataBuildingOptions delegate) {
this.delegate = delegate;
}
@Override
public StandardServiceRegistry getServiceRegistry() {
return delegate.getServiceRegistry();
}
@Override
public MappingDefaults getMappingDefaults() {
return delegate.getMappingDefaults();
}
@Override
public List<BasicType> getBasicTypeRegistrations() {
return delegate.getBasicTypeRegistrations();
}
@Override
public IndexView getJandexView() {
return delegate.getJandexView();
}
@Override
public ScanOptions getScanOptions() {
return delegate.getScanOptions();
}
@Override
public ScanEnvironment getScanEnvironment() {
return delegate.getScanEnvironment();
}
@Override
public Object getScanner() {
return delegate.getScanner();
}
@Override
public ArchiveDescriptorFactory getArchiveDescriptorFactory() {
return delegate.getArchiveDescriptorFactory();
}
@Override
public ClassLoader getTempClassLoader() {
return delegate.getTempClassLoader();
}
@Override
public ImplicitNamingStrategy getImplicitNamingStrategy() {
return delegate.getImplicitNamingStrategy();
}
@Override
public PhysicalNamingStrategy getPhysicalNamingStrategy() {
return delegate.getPhysicalNamingStrategy();
}
@Override
public ReflectionManager getReflectionManager() {
return delegate.getReflectionManager();
}
@Override
public SharedCacheMode getSharedCacheMode() {
return delegate.getSharedCacheMode();
}
@Override
public AccessType getImplicitCacheAccessType() {
return delegate.getImplicitCacheAccessType();
}
@Override
public MultiTenancyStrategy getMultiTenancyStrategy() {
return delegate.getMultiTenancyStrategy();
}
@Override
public IdGeneratorStrategyInterpreter getIdGenerationTypeInterpreter() {
return delegate.getIdGenerationTypeInterpreter();
}
@Override
public List<CacheRegionDefinition> getCacheRegionDefinitions() {
return delegate.getCacheRegionDefinitions();
}
@Override
public boolean ignoreExplicitDiscriminatorsForJoinedInheritance() {
return delegate.ignoreExplicitDiscriminatorsForJoinedInheritance();
}
@Override
public boolean createImplicitDiscriminatorsForJoinedInheritance() {
return delegate.createImplicitDiscriminatorsForJoinedInheritance();
}
@Override
public boolean shouldImplicitlyForceDiscriminatorInSelect() {
return delegate.shouldImplicitlyForceDiscriminatorInSelect();
}
@Override
public boolean useNationalizedCharacterData() {
return delegate.useNationalizedCharacterData();
}
@Override
public boolean isSpecjProprietarySyntaxEnabled() {
return delegate.isSpecjProprietarySyntaxEnabled();
}
@Override
public List<MetadataSourceType> getSourceProcessOrdering() {
return delegate.getSourceProcessOrdering();
}
@Override
public Map<String, SQLFunction> getSqlFunctions() {
return delegate.getSqlFunctions();
}
@Override
public List<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjectList() {
return delegate.getAuxiliaryDatabaseObjectList();
}
@Override
public List<AttributeConverterDefinition> getAttributeConverters() {
return delegate.getAttributeConverters();
}
}

View File

@ -0,0 +1,29 @@
/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.spi;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
/**
* An extension point for integrators that wish to hook into the process of how a {@link Metadata} is built. Intended as
* a "discoverable service" ({@link java.util.ServiceLoader}). There can be at most one implementation discovered that
* returns a non-null SessionFactoryBuilder.
*
* @author Gunnar Morling
*/
public interface MetadataBuilderFactory {
/**
* Creates a {@link MetadataBuilderImplementor}.
*
* @param metadatasources The current metadata sources
* @param defaultBuilder The default builder, may be used as a delegate
* @return a new metadata builder
*/
MetadataBuilderImplementor getMetadataBuilder(MetadataSources metadatasources, MetadataBuilderImplementor defaultBuilder);
}