more fallout from new Generator instantiation lifecycle
This commit is contained in:
parent
18aa8a7c70
commit
e7776049af
|
@ -56,6 +56,7 @@ import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
|
||||||
import org.hibernate.boot.model.relational.Database;
|
import org.hibernate.boot.model.relational.Database;
|
||||||
import org.hibernate.boot.model.relational.Namespace;
|
import org.hibernate.boot.model.relational.Namespace;
|
||||||
import org.hibernate.boot.model.relational.QualifiedTableName;
|
import org.hibernate.boot.model.relational.QualifiedTableName;
|
||||||
|
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||||
import org.hibernate.boot.model.source.internal.ImplicitColumnNamingSecondPass;
|
import org.hibernate.boot.model.source.internal.ImplicitColumnNamingSecondPass;
|
||||||
import org.hibernate.boot.model.source.spi.LocalMetadataBuildingContext;
|
import org.hibernate.boot.model.source.spi.LocalMetadataBuildingContext;
|
||||||
import org.hibernate.boot.models.categorize.internal.ClassLoaderServiceLoading;
|
import org.hibernate.boot.models.categorize.internal.ClassLoaderServiceLoading;
|
||||||
|
@ -78,6 +79,8 @@ import org.hibernate.boot.spi.PropertyData;
|
||||||
import org.hibernate.boot.spi.SecondPass;
|
import org.hibernate.boot.spi.SecondPass;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||||
|
import org.hibernate.engine.config.spi.StandardConverters;
|
||||||
import org.hibernate.engine.spi.FilterDefinition;
|
import org.hibernate.engine.spi.FilterDefinition;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
|
@ -120,6 +123,9 @@ import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.MapsId;
|
import jakarta.persistence.MapsId;
|
||||||
|
|
||||||
import static org.hibernate.boot.model.naming.Identifier.toIdentifier;
|
import static org.hibernate.boot.model.naming.Identifier.toIdentifier;
|
||||||
|
import static org.hibernate.boot.model.relational.internal.SqlStringGenerationContextImpl.fromExplicit;
|
||||||
|
import static org.hibernate.cfg.MappingSettings.DEFAULT_CATALOG;
|
||||||
|
import static org.hibernate.cfg.MappingSettings.DEFAULT_SCHEMA;
|
||||||
import static org.hibernate.internal.util.collections.CollectionHelper.mapOfSize;
|
import static org.hibernate.internal.util.collections.CollectionHelper.mapOfSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,7 +138,8 @@ import static org.hibernate.internal.util.collections.CollectionHelper.mapOfSize
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector, ConverterRegistry {
|
public class InFlightMetadataCollectorImpl
|
||||||
|
implements InFlightMetadataCollector, ConverterRegistry, GeneratorSettings {
|
||||||
private static final CoreMessageLogger log = CoreLogging.messageLogger( InFlightMetadataCollectorImpl.class );
|
private static final CoreMessageLogger log = CoreLogging.messageLogger( InFlightMetadataCollectorImpl.class );
|
||||||
|
|
||||||
private final BootstrapContext bootstrapContext;
|
private final BootstrapContext bootstrapContext;
|
||||||
|
@ -170,6 +177,8 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector,
|
||||||
|
|
||||||
private Map<String, SqmFunctionDescriptor> sqlFunctionMap;
|
private Map<String, SqmFunctionDescriptor> sqlFunctionMap;
|
||||||
|
|
||||||
|
final ConfigurationService configurationService;
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// All the annotation-processing-specific state :(
|
// All the annotation-processing-specific state :(
|
||||||
private final Set<String> defaultIdentifierGeneratorNames = new HashSet<>();
|
private final Set<String> defaultIdentifierGeneratorNames = new HashSet<>();
|
||||||
|
@ -210,16 +219,12 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector,
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrapContext.getAuxiliaryDatabaseObjectList().forEach( getDatabase()::addAuxiliaryDatabaseObject );
|
bootstrapContext.getAuxiliaryDatabaseObjectList().forEach( getDatabase()::addAuxiliaryDatabaseObject );
|
||||||
|
|
||||||
|
configurationService = bootstrapContext.getServiceRegistry().requireService(ConfigurationService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InFlightMetadataCollectorImpl(
|
public InFlightMetadataCollectorImpl(BootstrapContext bootstrapContext, MetadataBuildingOptions options) {
|
||||||
BootstrapContext bootstrapContext,
|
this( bootstrapContext, createModelBuildingContext( bootstrapContext ), options );
|
||||||
MetadataBuildingOptions options) {
|
|
||||||
this(
|
|
||||||
bootstrapContext,
|
|
||||||
createModelBuildingContext( bootstrapContext ),
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SourceModelBuildingContext createModelBuildingContext(BootstrapContext bootstrapContext) {
|
private static SourceModelBuildingContext createModelBuildingContext(BootstrapContext bootstrapContext) {
|
||||||
|
@ -2204,20 +2209,7 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector,
|
||||||
private void handleIdentifierValueBinding(
|
private void handleIdentifierValueBinding(
|
||||||
KeyValue identifierValueBinding, Dialect dialect, RootClass entityBinding, Property identifierProperty) {
|
KeyValue identifierValueBinding, Dialect dialect, RootClass entityBinding, Property identifierProperty) {
|
||||||
try {
|
try {
|
||||||
identifierValueBinding.createGenerator( dialect, entityBinding, identifierProperty,
|
identifierValueBinding.createGenerator( dialect, entityBinding, identifierProperty, this );
|
||||||
new GeneratorSettings() {
|
|
||||||
@Override
|
|
||||||
public String getDefaultCatalog() {
|
|
||||||
//TODO: does not have access to property-configured default
|
|
||||||
return persistenceUnitMetadata.getDefaultCatalog();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDefaultSchema() {
|
|
||||||
//TODO: does not have access to property-configured default
|
|
||||||
return persistenceUnitMetadata.getDefaultSchema();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
catch (MappingException e) {
|
catch (MappingException e) {
|
||||||
// ignore this for now. The reasoning being "non-reflective" binding as needed
|
// ignore this for now. The reasoning being "non-reflective" binding as needed
|
||||||
|
@ -2227,4 +2219,21 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector,
|
||||||
log.debugf( "Ignoring exception thrown when trying to build IdentifierGenerator as part of Metadata building", e );
|
log.debugf( "Ignoring exception thrown when trying to build IdentifierGenerator as part of Metadata building", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultCatalog() {
|
||||||
|
final String defaultCatalog = configurationService.getSetting( DEFAULT_CATALOG, StandardConverters.STRING );
|
||||||
|
return defaultCatalog == null ? persistenceUnitMetadata.getDefaultCatalog() : defaultCatalog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultSchema() {
|
||||||
|
final String defaultSchema = configurationService.getSetting( DEFAULT_SCHEMA, StandardConverters.STRING );
|
||||||
|
return defaultSchema == null ? persistenceUnitMetadata.getDefaultSchema() : defaultSchema;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqlStringGenerationContext getSqlStringGenerationContext() {
|
||||||
|
return fromExplicit( database.getJdbcEnvironment(), database, getDefaultCatalog(), getDefaultSchema() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,6 +244,8 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
|
||||||
* neither explicitly nor implicitly (see the concept of implicit catalog in XML mapping).
|
* neither explicitly nor implicitly (see the concept of implicit catalog in XML mapping).
|
||||||
*
|
*
|
||||||
* @return The default catalog to use.
|
* @return The default catalog to use.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.cfg.MappingSettings#DEFAULT_CATALOG
|
||||||
*/
|
*/
|
||||||
default String getDefaultCatalog() {
|
default String getDefaultCatalog() {
|
||||||
return null;
|
return null;
|
||||||
|
@ -254,6 +256,8 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
|
||||||
* neither explicitly nor implicitly (see the concept of implicit schema in XML mapping).
|
* neither explicitly nor implicitly (see the concept of implicit schema in XML mapping).
|
||||||
*
|
*
|
||||||
* @return The default schema to use.
|
* @return The default schema to use.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.cfg.MappingSettings#DEFAULT_SCHEMA
|
||||||
*/
|
*/
|
||||||
default String getDefaultSchema() {
|
default String getDefaultSchema() {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -28,7 +28,9 @@ import static org.hibernate.boot.model.relational.internal.SqlStringGenerationCo
|
||||||
@Incubating
|
@Incubating
|
||||||
public interface GeneratorCreationContext {
|
public interface GeneratorCreationContext {
|
||||||
/**
|
/**
|
||||||
* View of the relational database objects (tables, sequences, ...) and namespaces (catalogs and schemas).
|
* View of the relational database objects (tables, sequences, etc.)
|
||||||
|
* and namespaces (catalogs and schemas). Generators may add new
|
||||||
|
* tables or sequences to the returned {@link Database}.
|
||||||
*/
|
*/
|
||||||
Database getDatabase();
|
Database getDatabase();
|
||||||
|
|
||||||
|
@ -69,6 +71,9 @@ public interface GeneratorCreationContext {
|
||||||
return getProperty().getType();
|
return getProperty().getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link SqlStringGenerationContext} to use when generating SQL.
|
||||||
|
*/
|
||||||
default SqlStringGenerationContext getSqlStringGenerationContext() {
|
default SqlStringGenerationContext getSqlStringGenerationContext() {
|
||||||
final Database database = getDatabase();
|
final Database database = getDatabase();
|
||||||
return fromExplicit( database.getJdbcEnvironment(), database, getDefaultCatalog(), getDefaultSchema() );
|
return fromExplicit( database.getJdbcEnvironment(), database, getDefaultCatalog(), getDefaultSchema() );
|
||||||
|
|
|
@ -72,6 +72,7 @@ import org.hibernate.integrator.spi.IntegratorService;
|
||||||
import org.hibernate.jpa.internal.ExceptionMapperLegacyJpaImpl;
|
import org.hibernate.jpa.internal.ExceptionMapperLegacyJpaImpl;
|
||||||
import org.hibernate.jpa.internal.PersistenceUnitUtilImpl;
|
import org.hibernate.jpa.internal.PersistenceUnitUtilImpl;
|
||||||
import org.hibernate.mapping.Collection;
|
import org.hibernate.mapping.Collection;
|
||||||
|
import org.hibernate.mapping.GeneratorSettings;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.mapping.RootClass;
|
import org.hibernate.mapping.RootClass;
|
||||||
import org.hibernate.metamodel.internal.RuntimeMetamodelsImpl;
|
import org.hibernate.metamodel.internal.RuntimeMetamodelsImpl;
|
||||||
|
@ -277,16 +278,16 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
|
||||||
// create runtime metamodels (mapping and JPA)
|
// create runtime metamodels (mapping and JPA)
|
||||||
final RuntimeMetamodelsImpl runtimeMetamodelsImpl = new RuntimeMetamodelsImpl();
|
final RuntimeMetamodelsImpl runtimeMetamodelsImpl = new RuntimeMetamodelsImpl();
|
||||||
runtimeMetamodels = runtimeMetamodelsImpl;
|
runtimeMetamodels = runtimeMetamodelsImpl;
|
||||||
final MappingMetamodelImpl mappingMetamodelImpl =
|
final MappingMetamodelImpl mappingMetamodelImpl = new MappingMetamodelImpl( typeConfiguration, serviceRegistry );
|
||||||
new MappingMetamodelImpl( typeConfiguration, serviceRegistry );
|
|
||||||
runtimeMetamodelsImpl.setMappingMetamodel( mappingMetamodelImpl );
|
runtimeMetamodelsImpl.setMappingMetamodel( mappingMetamodelImpl );
|
||||||
fastSessionServices = new FastSessionServices( this );
|
fastSessionServices = new FastSessionServices( this );
|
||||||
initializeMappingModel( mappingMetamodelImpl, bootstrapContext, bootMetamodel, options );
|
mappingMetamodelImpl.finishInitialization(
|
||||||
|
new ModelCreationContext( bootstrapContext, bootMetamodel, mappingMetamodelImpl, typeConfiguration ) );
|
||||||
runtimeMetamodelsImpl.setJpaMetamodel( mappingMetamodelImpl.getJpaMetamodel() );
|
runtimeMetamodelsImpl.setJpaMetamodel( mappingMetamodelImpl.getJpaMetamodel() );
|
||||||
|
|
||||||
// this needs to happen after the mapping metamodel is
|
// this needs to happen after the mapping metamodel is
|
||||||
// completely built, since we need to use the persisters
|
// completely built, since we need to use the persisters
|
||||||
fetchProfiles = getFetchProfiles( bootMetamodel, runtimeMetamodels );
|
fetchProfiles = getFetchProfiles( bootMetamodel, runtimeMetamodelsImpl);
|
||||||
|
|
||||||
defaultSessionOpenOptions = createDefaultSessionOpenOptionsIfPossible();
|
defaultSessionOpenOptions = createDefaultSessionOpenOptionsIfPossible();
|
||||||
temporarySessionOpenOptions = defaultSessionOpenOptions == null ? null : buildTemporarySessionOpenOptions();
|
temporarySessionOpenOptions = defaultSessionOpenOptions == null ? null : buildTemporarySessionOpenOptions();
|
||||||
|
@ -320,102 +321,6 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
|
||||||
LOG.debug( "Instantiated SessionFactory" );
|
LOG.debug( "Instantiated SessionFactory" );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeMappingModel(
|
|
||||||
MappingMetamodelImpl mappingMetamodelImpl,
|
|
||||||
BootstrapContext bootstrapContext,
|
|
||||||
MetadataImplementor bootMetamodel,
|
|
||||||
SessionFactoryOptions options) {
|
|
||||||
mappingMetamodelImpl.finishInitialization( runtimeModelCreationContext(
|
|
||||||
bootstrapContext,
|
|
||||||
bootMetamodel,
|
|
||||||
mappingMetamodelImpl,
|
|
||||||
mappingMetamodelImpl.getTypeConfiguration(),
|
|
||||||
options
|
|
||||||
) );
|
|
||||||
}
|
|
||||||
|
|
||||||
private RuntimeModelCreationContext runtimeModelCreationContext(
|
|
||||||
BootstrapContext bootstrapContext,
|
|
||||||
MetadataImplementor bootMetamodel,
|
|
||||||
MappingMetamodelImplementor mappingMetamodel,
|
|
||||||
TypeConfiguration typeConfiguration,
|
|
||||||
SessionFactoryOptions options) {
|
|
||||||
return new RuntimeModelCreationContext() {
|
|
||||||
final Map<String,Generator> generators = new HashMap<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BootstrapContext getBootstrapContext() {
|
|
||||||
return bootstrapContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SessionFactoryImplementor getSessionFactory() {
|
|
||||||
// this is bad, we're not yet fully-initialized
|
|
||||||
return SessionFactoryImpl.this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MetadataImplementor getBootModel() {
|
|
||||||
return bootMetamodel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MappingMetamodelImplementor getDomainModel() {
|
|
||||||
return mappingMetamodel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CacheImplementor getCache() {
|
|
||||||
return cacheAccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getSettings() {
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialect getDialect() {
|
|
||||||
return jdbcServices.getDialect();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SqmFunctionRegistry getFunctionRegistry() {
|
|
||||||
return queryEngine.getSqmFunctionRegistry();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TypeConfiguration getTypeConfiguration() {
|
|
||||||
return typeConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SessionFactoryOptions getSessionFactoryOptions() {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JdbcServices getJdbcServices() {
|
|
||||||
return jdbcServices;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SqlStringGenerationContext getSqlStringGenerationContext() {
|
|
||||||
return sqlStringGenerationContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServiceRegistry getServiceRegistry() {
|
|
||||||
return serviceRegistry;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Generator> getGenerators() {
|
|
||||||
return generators;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SqlStringGenerationContext createSqlStringGenerationContext(
|
private static SqlStringGenerationContext createSqlStringGenerationContext(
|
||||||
MetadataImplementor bootMetamodel,
|
MetadataImplementor bootMetamodel,
|
||||||
SessionFactoryOptions options,
|
SessionFactoryOptions options,
|
||||||
|
@ -1687,4 +1592,110 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
|
||||||
CLOSING,
|
CLOSING,
|
||||||
CLOSED
|
CLOSED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ModelCreationContext implements RuntimeModelCreationContext, GeneratorSettings {
|
||||||
|
final Map<String, Generator> generators;
|
||||||
|
private final BootstrapContext bootstrapContext;
|
||||||
|
private final MetadataImplementor bootMetamodel;
|
||||||
|
private final MappingMetamodelImplementor mappingMetamodel;
|
||||||
|
private final TypeConfiguration typeConfiguration;
|
||||||
|
|
||||||
|
private ModelCreationContext(
|
||||||
|
BootstrapContext bootstrapContext,
|
||||||
|
MetadataImplementor bootMetamodel,
|
||||||
|
MappingMetamodelImplementor mappingMetamodel,
|
||||||
|
TypeConfiguration typeConfiguration) {
|
||||||
|
this.bootstrapContext = bootstrapContext;
|
||||||
|
this.bootMetamodel = bootMetamodel;
|
||||||
|
this.mappingMetamodel = mappingMetamodel;
|
||||||
|
this.typeConfiguration = typeConfiguration;
|
||||||
|
generators = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BootstrapContext getBootstrapContext() {
|
||||||
|
return bootstrapContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SessionFactoryImplementor getSessionFactory() {
|
||||||
|
// this is bad, we're not yet fully-initialized
|
||||||
|
return SessionFactoryImpl.this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetadataImplementor getBootModel() {
|
||||||
|
return bootMetamodel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MappingMetamodelImplementor getDomainModel() {
|
||||||
|
return mappingMetamodel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheImplementor getCache() {
|
||||||
|
return cacheAccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getSettings() {
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialect getDialect() {
|
||||||
|
return jdbcServices.getDialect();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqmFunctionRegistry getFunctionRegistry() {
|
||||||
|
return queryEngine.getSqmFunctionRegistry();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TypeConfiguration getTypeConfiguration() {
|
||||||
|
return typeConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SessionFactoryOptions getSessionFactoryOptions() {
|
||||||
|
return sessionFactoryOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JdbcServices getJdbcServices() {
|
||||||
|
return jdbcServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServiceRegistry getServiceRegistry() {
|
||||||
|
return serviceRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Generator> getGenerators() {
|
||||||
|
return generators;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GeneratorSettings getGeneratorSettings() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultCatalog() {
|
||||||
|
return sessionFactoryOptions.getDefaultCatalog();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultSchema() {
|
||||||
|
return sessionFactoryOptions.getDefaultSchema();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqlStringGenerationContext getSqlStringGenerationContext() {
|
||||||
|
return sqlStringGenerationContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,29 @@
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
||||||
|
import org.hibernate.Incubating;
|
||||||
|
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||||
|
import org.hibernate.dialect.Dialect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Exposes the default catalog and schema to the
|
||||||
|
* {@linkplain KeyValue#createGenerator(Dialect, RootClass, Property, GeneratorSettings)
|
||||||
|
* generator creation process}. The defaults specified here are ultimately
|
||||||
|
* passed to the {@linkplain org.hibernate.generator.Generator generator}
|
||||||
|
* itself via the {@link org.hibernate.generator.GeneratorCreationContext}.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.cfg.MappingSettings#DEFAULT_CATALOG
|
||||||
|
* @see org.hibernate.cfg.MappingSettings#DEFAULT_SCHEMA
|
||||||
|
* @see org.hibernate.boot.spi.SessionFactoryOptions#getDefaultCatalog()
|
||||||
|
* @see org.hibernate.boot.spi.SessionFactoryOptions#getDefaultSchema()
|
||||||
|
*
|
||||||
|
* @since 7
|
||||||
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
|
@Incubating
|
||||||
public interface GeneratorSettings {
|
public interface GeneratorSettings {
|
||||||
String getDefaultCatalog();
|
String getDefaultCatalog();
|
||||||
String getDefaultSchema();
|
String getDefaultSchema();
|
||||||
|
SqlStringGenerationContext getSqlStringGenerationContext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.generator.Generator;
|
import org.hibernate.generator.Generator;
|
||||||
|
|
||||||
|
@ -25,24 +26,9 @@ public interface KeyValue extends Value {
|
||||||
|
|
||||||
boolean isUpdateable();
|
boolean isUpdateable();
|
||||||
|
|
||||||
@Deprecated(since = "7.0")
|
@Deprecated(since = "7.0", forRemoval = true)
|
||||||
default Generator createGenerator(Dialect dialect, RootClass rootClass) {
|
Generator createGenerator(Dialect dialect, RootClass rootClass);
|
||||||
return createGenerator( dialect, rootClass, null, new GeneratorSettings() {
|
|
||||||
@Override
|
|
||||||
public String getDefaultCatalog() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Incubating
|
||||||
public String getDefaultSchema() {
|
Generator createGenerator(Dialect dialect, RootClass rootClass, Property property, GeneratorSettings defaults);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
Generator createGenerator(
|
|
||||||
Dialect dialect,
|
|
||||||
RootClass rootClass,
|
|
||||||
Property property,
|
|
||||||
GeneratorSettings defaults);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
|
||||||
import org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext;
|
import org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext;
|
||||||
import org.hibernate.boot.model.internal.AnnotatedJoinColumns;
|
import org.hibernate.boot.model.internal.AnnotatedJoinColumns;
|
||||||
import org.hibernate.boot.model.relational.Database;
|
import org.hibernate.boot.model.relational.Database;
|
||||||
|
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||||
|
@ -61,6 +62,7 @@ import static java.lang.Boolean.parseBoolean;
|
||||||
import static org.hibernate.boot.model.convert.spi.ConverterDescriptor.TYPE_NAME_PREFIX;
|
import static org.hibernate.boot.model.convert.spi.ConverterDescriptor.TYPE_NAME_PREFIX;
|
||||||
import static org.hibernate.boot.model.internal.GeneratorBinder.ASSIGNED_GENERATOR_NAME;
|
import static org.hibernate.boot.model.internal.GeneratorBinder.ASSIGNED_GENERATOR_NAME;
|
||||||
import static org.hibernate.boot.model.internal.GeneratorBinder.ASSIGNED_IDENTIFIER_GENERATOR_CREATOR;
|
import static org.hibernate.boot.model.internal.GeneratorBinder.ASSIGNED_IDENTIFIER_GENERATOR_CREATOR;
|
||||||
|
import static org.hibernate.boot.model.relational.internal.SqlStringGenerationContextImpl.fromExplicit;
|
||||||
import static org.hibernate.internal.util.collections.ArrayHelper.toBooleanArray;
|
import static org.hibernate.internal.util.collections.ArrayHelper.toBooleanArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -373,6 +375,28 @@ public abstract class SimpleValue implements KeyValue {
|
||||||
return customIdGeneratorCreator;
|
return customIdGeneratorCreator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(since = "7.0", forRemoval = true)
|
||||||
|
@Override @SuppressWarnings("removal")
|
||||||
|
public Generator createGenerator(Dialect dialect, RootClass rootClass) {
|
||||||
|
return createGenerator( dialect, rootClass, null, new GeneratorSettings() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultCatalog() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultSchema() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqlStringGenerationContext getSqlStringGenerationContext() {
|
||||||
|
final Database database = buildingContext.getMetadataCollector().getDatabase();
|
||||||
|
return fromExplicit( database.getJdbcEnvironment(), database, getDefaultCatalog(), getDefaultSchema() );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Generator createGenerator(
|
public Generator createGenerator(
|
||||||
Dialect dialect,
|
Dialect dialect,
|
||||||
|
@ -857,8 +881,7 @@ public abstract class SimpleValue implements KeyValue {
|
||||||
|
|
||||||
for ( int i = 0; i < columns.size(); i++ ) {
|
for ( int i = 0; i < columns.size(); i++ ) {
|
||||||
final Selectable selectable = columns.get(i);
|
final Selectable selectable = columns.get(i);
|
||||||
if ( selectable instanceof Column ) {
|
if ( selectable instanceof Column column ) {
|
||||||
final Column column = (Column) selectable;
|
|
||||||
columnNames[i] = column.getName();
|
columnNames[i] = column.getName();
|
||||||
columnLengths[i] = column.getLength();
|
columnLengths[i] = column.getLength();
|
||||||
}
|
}
|
||||||
|
@ -1054,6 +1077,11 @@ public abstract class SimpleValue implements KeyValue {
|
||||||
return buildingContext.getBootstrapContext().getServiceRegistry();
|
return buildingContext.getBootstrapContext().getServiceRegistry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqlStringGenerationContext getSqlStringGenerationContext() {
|
||||||
|
return defaults.getSqlStringGenerationContext();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDefaultCatalog() {
|
public String getDefaultCatalog() {
|
||||||
return defaults.getDefaultCatalog();
|
return defaults.getDefaultCatalog();
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.generator.Generator;
|
import org.hibernate.generator.Generator;
|
||||||
|
import org.hibernate.mapping.GeneratorSettings;
|
||||||
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
|
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
|
||||||
import org.hibernate.service.ServiceRegistry;
|
import org.hibernate.service.ServiceRegistry;
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
|
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
|
||||||
|
@ -61,4 +62,6 @@ public interface RuntimeModelCreationContext {
|
||||||
ServiceRegistry getServiceRegistry();
|
ServiceRegistry getServiceRegistry();
|
||||||
|
|
||||||
Map<String, Generator> getGenerators();
|
Map<String, Generator> getGenerators();
|
||||||
|
|
||||||
|
GeneratorSettings getGeneratorSettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,6 @@ import org.hibernate.mapping.BasicValue;
|
||||||
import org.hibernate.mapping.Collection;
|
import org.hibernate.mapping.Collection;
|
||||||
import org.hibernate.mapping.Column;
|
import org.hibernate.mapping.Column;
|
||||||
import org.hibernate.mapping.Formula;
|
import org.hibernate.mapping.Formula;
|
||||||
import org.hibernate.mapping.GeneratorSettings;
|
|
||||||
import org.hibernate.mapping.IdentifierCollection;
|
import org.hibernate.mapping.IdentifierCollection;
|
||||||
import org.hibernate.mapping.IndexedCollection;
|
import org.hibernate.mapping.IndexedCollection;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
|
@ -596,18 +595,7 @@ public abstract class AbstractCollectionPersister
|
||||||
private BeforeExecutionGenerator createGenerator(RuntimeModelCreationContext context, IdentifierCollection collection) {
|
private BeforeExecutionGenerator createGenerator(RuntimeModelCreationContext context, IdentifierCollection collection) {
|
||||||
final Generator generator =
|
final Generator generator =
|
||||||
collection.getIdentifier()
|
collection.getIdentifier()
|
||||||
.createGenerator( context.getDialect(), null, null,
|
.createGenerator( context.getDialect(), null, null, context.getGeneratorSettings() );
|
||||||
new GeneratorSettings() {
|
|
||||||
@Override
|
|
||||||
public String getDefaultCatalog() {
|
|
||||||
return context.getSessionFactoryOptions().getDefaultCatalog();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDefaultSchema() {
|
|
||||||
return context.getSessionFactoryOptions().getDefaultCatalog();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
if ( generator.generatedOnExecution() ) {
|
if ( generator.generatedOnExecution() ) {
|
||||||
throw new MappingException("must be an BeforeExecutionGenerator"); //TODO fix message
|
throw new MappingException("must be an BeforeExecutionGenerator"); //TODO fix message
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.hibernate.HibernateException;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.annotations.NotFoundAction;
|
import org.hibernate.annotations.NotFoundAction;
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
import org.hibernate.boot.spi.MetadataImplementor;
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
|
||||||
import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementHelper;
|
import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementHelper;
|
||||||
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataNonPojoImpl;
|
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataNonPojoImpl;
|
||||||
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataPojoImpl;
|
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataPojoImpl;
|
||||||
|
@ -35,7 +34,6 @@ import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.mapping.Component;
|
import org.hibernate.mapping.Component;
|
||||||
import org.hibernate.mapping.GeneratorCreator;
|
import org.hibernate.mapping.GeneratorCreator;
|
||||||
import org.hibernate.mapping.GeneratorSettings;
|
|
||||||
import org.hibernate.mapping.ManyToOne;
|
import org.hibernate.mapping.ManyToOne;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.mapping.Property;
|
import org.hibernate.mapping.Property;
|
||||||
|
@ -485,19 +483,8 @@ public class EntityMetamodel implements Serializable {
|
||||||
creationContext.getDialect(),
|
creationContext.getDialect(),
|
||||||
persistentClass.getRootClass(),
|
persistentClass.getRootClass(),
|
||||||
persistentClass.getIdentifierProperty(),
|
persistentClass.getIdentifierProperty(),
|
||||||
new GeneratorSettings() {
|
creationContext.getGeneratorSettings()
|
||||||
SessionFactoryOptions options() {
|
);
|
||||||
return creationContext.getSessionFactory().getSessionFactoryOptions();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String getDefaultCatalog() {
|
|
||||||
return options().getDefaultCatalog();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String getDefaultSchema() {
|
|
||||||
return options().getDefaultSchema();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
creationContext.getGenerators().put( rootName, idgenerator );
|
creationContext.getGenerators().put( rootName, idgenerator );
|
||||||
return idgenerator;
|
return idgenerator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.generator.Generator;
|
import org.hibernate.generator.Generator;
|
||||||
|
import org.hibernate.mapping.GeneratorSettings;
|
||||||
import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
|
import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
|
||||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||||
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
|
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
|
||||||
|
@ -101,78 +102,7 @@ public class LocalTemporaryTableMutationStrategyNoDropTest {
|
||||||
session.getEntityPersister( null, new TestEntity() ),
|
session.getEntityPersister( null, new TestEntity() ),
|
||||||
basename -> TemporaryTable.ID_TABLE_PREFIX + basename,
|
basename -> TemporaryTable.ID_TABLE_PREFIX + basename,
|
||||||
dialect,
|
dialect,
|
||||||
new RuntimeModelCreationContext() {
|
new ModelCreationContext( sessionFactory, scope, dialect, jdbcServices )
|
||||||
|
|
||||||
@Override
|
|
||||||
public SessionFactoryImplementor getSessionFactory() {
|
|
||||||
return sessionFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BootstrapContext getBootstrapContext() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MetadataImplementor getBootModel() {
|
|
||||||
return scope.getMetadataImplementor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MappingMetamodelImplementor getDomainModel() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SqmFunctionRegistry getFunctionRegistry() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getSettings() {
|
|
||||||
return sessionFactory.getProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialect getDialect() {
|
|
||||||
return dialect;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CacheImplementor getCache() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SessionFactoryOptions getSessionFactoryOptions() {
|
|
||||||
return sessionFactory.getSessionFactoryOptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JdbcServices getJdbcServices() {
|
|
||||||
return jdbcServices;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SqlStringGenerationContext getSqlStringGenerationContext() {
|
|
||||||
return SqlStringGenerationContextImpl.fromExplicit(
|
|
||||||
jdbcServices.getJdbcEnvironment(),
|
|
||||||
scope.getMetadataImplementor().getDatabase(),
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public org.hibernate.service.ServiceRegistry getServiceRegistry() {
|
|
||||||
return sessionFactory.getServiceRegistry();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Generator> getGenerators() {
|
|
||||||
return emptyMap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,4 +141,104 @@ public class LocalTemporaryTableMutationStrategyNoDropTest {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ModelCreationContext implements RuntimeModelCreationContext, GeneratorSettings {
|
||||||
|
|
||||||
|
private final SessionFactoryImplementor sessionFactory;
|
||||||
|
private final SessionFactoryScope scope;
|
||||||
|
private final Dialect dialect;
|
||||||
|
private final JdbcServices jdbcServices;
|
||||||
|
|
||||||
|
public ModelCreationContext(SessionFactoryImplementor sessionFactory, SessionFactoryScope scope, Dialect dialect, JdbcServices jdbcServices) {
|
||||||
|
this.sessionFactory = sessionFactory;
|
||||||
|
this.scope = scope;
|
||||||
|
this.dialect = dialect;
|
||||||
|
this.jdbcServices = jdbcServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SessionFactoryImplementor getSessionFactory() {
|
||||||
|
return sessionFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BootstrapContext getBootstrapContext() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetadataImplementor getBootModel() {
|
||||||
|
return scope.getMetadataImplementor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MappingMetamodelImplementor getDomainModel() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqmFunctionRegistry getFunctionRegistry() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getSettings() {
|
||||||
|
return sessionFactory.getProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialect getDialect() {
|
||||||
|
return dialect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CacheImplementor getCache() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SessionFactoryOptions getSessionFactoryOptions() {
|
||||||
|
return sessionFactory.getSessionFactoryOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JdbcServices getJdbcServices() {
|
||||||
|
return jdbcServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqlStringGenerationContext getSqlStringGenerationContext() {
|
||||||
|
return SqlStringGenerationContextImpl.fromExplicit(
|
||||||
|
jdbcServices.getJdbcEnvironment(),
|
||||||
|
scope.getMetadataImplementor().getDatabase(),
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.hibernate.service.ServiceRegistry getServiceRegistry() {
|
||||||
|
return sessionFactory.getServiceRegistry();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Generator> getGenerators() {
|
||||||
|
return emptyMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultCatalog() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultSchema() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GeneratorSettings getGeneratorSettings() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import org.hibernate.boot.Metadata;
|
import org.hibernate.boot.Metadata;
|
||||||
import org.hibernate.boot.MetadataSources;
|
import org.hibernate.boot.MetadataSources;
|
||||||
|
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||||
|
import org.hibernate.boot.model.relational.internal.SqlStringGenerationContextImpl;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
|
@ -103,6 +105,11 @@ public class UnnamedGeneratorTests {
|
||||||
public String getDefaultSchema() {
|
public String getDefaultSchema() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SqlStringGenerationContext getSqlStringGenerationContext() {
|
||||||
|
return SqlStringGenerationContextImpl.forTests( metadata.getDatabase().getJdbcEnvironment() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue