diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java
index 8d36a0b1d1..dd510bb376 100644
--- a/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java
@@ -2261,11 +2261,7 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector,
// It was done this way in the old code too, so no "regression" here; but
// it could be done better
try {
- final Generator generator = identifierValueBinding.createGenerator(
- bootstrapContext.getIdentifierGeneratorFactory(),
- dialect,
- entityBinding
- );
+ final Generator generator = identifierValueBinding.createGenerator( dialect, entityBinding );
if ( generator instanceof ExportableProducer ) {
( (ExportableProducer) generator ).registerExportables( getDatabase() );
diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java
index 2809768246..6732eba3d7 100644
--- a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java
@@ -7,7 +7,6 @@
package org.hibernate.boot.internal;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.Callable;
@@ -63,7 +62,6 @@ import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.TimeZoneSupport;
import org.hibernate.engine.config.spi.ConfigurationService;
-import org.hibernate.engine.config.spi.StandardConverters;
import org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
@@ -71,8 +69,6 @@ import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.log.DeprecationLogger;
import org.hibernate.internal.util.NullnessHelper;
-import org.hibernate.internal.util.StringHelper;
-import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.CollectionClassification;
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
@@ -777,7 +773,7 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
return mappingDefaults;
}
- @Override
+ @Override @Deprecated
public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
return identifierGeneratorFactory;
}
diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadataBuildingOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadataBuildingOptions.java
index cb5bec8ae1..8518839824 100644
--- a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadataBuildingOptions.java
+++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadataBuildingOptions.java
@@ -53,7 +53,7 @@ public abstract class AbstractDelegatingMetadataBuildingOptions implements Metad
return delegate.getMappingDefaults();
}
- @Override
+ @Override @Deprecated
public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
return delegate.getIdentifierGeneratorFactory();
}
diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/BootstrapContext.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/BootstrapContext.java
index 4d5cf7dc2c..cf28e54d26 100644
--- a/hibernate-core/src/main/java/org/hibernate/boot/spi/BootstrapContext.java
+++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/BootstrapContext.java
@@ -75,6 +75,7 @@ public interface BootstrapContext {
*/
MetadataBuildingOptions getMetadataBuildingOptions();
+ @Deprecated(since="7.0", forRemoval = true)
default IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
return getMetadataBuildingOptions().getIdentifierGeneratorFactory();
}
diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java
index 374e099c41..0c05e1aef3 100644
--- a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java
+++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java
@@ -50,7 +50,10 @@ public interface MetadataBuildingOptions {
* The service implementing {@link IdentifierGeneratorFactory}.
*
* @implNote Almost always a {@link org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory}.
+ *
+ * @deprecated Use new {@link org.hibernate.generator.Generator} infrastructure
*/
+ @Deprecated(since="7.0", forRemoval = true)
IdentifierGeneratorFactory getIdentifierGeneratorFactory();
/**
diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/IdentifierGeneratorFactory.java b/hibernate-core/src/main/java/org/hibernate/id/factory/IdentifierGeneratorFactory.java
index ec21727bbf..8cd030cdbc 100644
--- a/hibernate-core/src/main/java/org/hibernate/id/factory/IdentifierGeneratorFactory.java
+++ b/hibernate-core/src/main/java/org/hibernate/id/factory/IdentifierGeneratorFactory.java
@@ -44,8 +44,11 @@ import jakarta.persistence.GenerationType;
* {@link org.hibernate.annotations.IdGeneratorType @IdGeneratorType} meta-annotation.
*
* @author Steve Ebersole
+ *
+ * @deprecated Use new {@link Generator} infrastructure
*/
@Incubating //this API is currently in flux
+@Deprecated(since = "7.0")
public interface IdentifierGeneratorFactory extends Service {
/**
* Create an {@link IdentifierGenerator} based on the given details.
diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java b/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java
index ed30caee7f..91a4b41bc2 100644
--- a/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java
+++ b/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java
@@ -57,7 +57,10 @@ import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
* declared using {@link org.hibernate.annotations.GenericGenerator}.
*
* @author Steve Ebersole
+ *
+ * @deprecated Use new {@link Generator} infrastructure
*/
+@Deprecated(since = "7.0")
public class StandardIdentifierGeneratorFactory
implements IdentifierGeneratorFactory, BeanContainer.LifecycleOptions, Serializable {
diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/package-info.java b/hibernate-core/src/main/java/org/hibernate/id/factory/package-info.java
index 66b6e8d2b9..e6329f07ed 100644
--- a/hibernate-core/src/main/java/org/hibernate/id/factory/package-info.java
+++ b/hibernate-core/src/main/java/org/hibernate/id/factory/package-info.java
@@ -14,5 +14,8 @@
* It is used when id generators are identified by stringly-typed names.
*
* @see org.hibernate.id.factory.IdentifierGeneratorFactory
+ *
+ * @deprecated Use new {@link org.hibernate.generator.Generator} infrastructure
*/
+@Deprecated(since = "7.0")
package org.hibernate.id.factory;
diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/spi/CustomIdGeneratorCreationContext.java b/hibernate-core/src/main/java/org/hibernate/id/factory/spi/CustomIdGeneratorCreationContext.java
index f7096fcf75..0578a9858f 100644
--- a/hibernate-core/src/main/java/org/hibernate/id/factory/spi/CustomIdGeneratorCreationContext.java
+++ b/hibernate-core/src/main/java/org/hibernate/id/factory/spi/CustomIdGeneratorCreationContext.java
@@ -7,13 +7,11 @@
package org.hibernate.id.factory.spi;
import org.hibernate.Incubating;
-import org.hibernate.id.factory.IdentifierGeneratorFactory;
-import org.hibernate.mapping.RootClass;
import org.hibernate.generator.GeneratorCreationContext;
+import org.hibernate.mapping.RootClass;
@Incubating
public interface CustomIdGeneratorCreationContext extends GeneratorCreationContext {
- IdentifierGeneratorFactory getIdentifierGeneratorFactory();
RootClass getRootClass();
// we could add these if it helps integrate old infrastructure
diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/spi/package-info.java b/hibernate-core/src/main/java/org/hibernate/id/factory/spi/package-info.java
index 237dca5944..34e6bf9254 100644
--- a/hibernate-core/src/main/java/org/hibernate/id/factory/spi/package-info.java
+++ b/hibernate-core/src/main/java/org/hibernate/id/factory/spi/package-info.java
@@ -7,5 +7,8 @@
/**
* Contains an SPI for id generator factories.
+ *
+ * @deprecated Use new {@link org.hibernate.generator.Generator} infrastructure
*/
+@Deprecated(since = "7.0")
package org.hibernate.id.factory.spi;
diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java
index 343d9238fd..57ad8a5294 100644
--- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java
@@ -73,7 +73,6 @@ import org.hibernate.generator.Generator;
import org.hibernate.graph.spi.RootGraphImplementor;
import org.hibernate.id.Configurable;
import org.hibernate.id.IdentifierGenerator;
-import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.integrator.spi.IntegratorService;
import org.hibernate.internal.util.StringHelper;
@@ -288,7 +287,7 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
try {
integrate( bootMetamodel, bootstrapContext, integratorObserver );
- identifierGenerators = createGenerators( jdbcServices, sqlStringGenerationContext, bootMetamodel, bootstrapContext );
+ identifierGenerators = createGenerators( jdbcServices, sqlStringGenerationContext, bootMetamodel );
bootMetamodel.orderColumns( false );
bootMetamodel.validate();
@@ -463,26 +462,22 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
private static Map createGenerators(
JdbcServices jdbcServices,
SqlStringGenerationContext sqlStringGenerationContext,
- MetadataImplementor bootMetamodel,
- BootstrapContext bootstrapContext) {
+ MetadataImplementor bootMetamodel) {
+ final Dialect dialect = jdbcServices.getJdbcEnvironment().getDialect();
final Map generators = new HashMap<>();
- bootMetamodel.getEntityBindings().stream()
- .filter( model -> !model.isInherited() )
- .forEach( model -> {
- final Generator generator = model.getIdentifier().createGenerator(
- bootstrapContext.getIdentifierGeneratorFactory(),
- jdbcServices.getJdbcEnvironment().getDialect(),
- (RootClass) model
- );
- if ( generator instanceof Configurable ) {
- final Configurable identifierGenerator = (Configurable) generator;
- identifierGenerator.initialize( sqlStringGenerationContext );
- }
- if ( generator.allowAssignedIdentifiers() ) {
- ( (SimpleValue) model.getIdentifier() ).setNullValue( "undefined" );
- }
- generators.put( model.getEntityName(), generator );
- } );
+ for ( PersistentClass model : bootMetamodel.getEntityBindings() ) {
+ if ( !model.isInherited() ) {
+ final Generator generator = model.getIdentifier().createGenerator( dialect, (RootClass) model );
+ if (generator instanceof Configurable) {
+ final Configurable identifierGenerator = (Configurable) generator;
+ identifierGenerator.initialize( sqlStringGenerationContext );
+ }
+ if ( generator.allowAssignedIdentifiers() ) {
+ ( (SimpleValue) model.getIdentifier() ).setNullValue( "undefined" );
+ }
+ generators.put( model.getEntityName(), generator );
+ }
+ }
return generators;
}
@@ -775,10 +770,6 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
return sqlStringGenerationContext;
}
- public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
- return null;
- }
-
@Override @Deprecated
public DeserializationResolver> getDeserializationResolver() {
return () -> (SessionFactoryImplementor)
diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java
index 7fbcbbbf31..c7d23594ff 100644
--- a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java
+++ b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java
@@ -36,7 +36,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.CompositeNestedGeneratedValueGenerator;
import org.hibernate.id.Configurable;
import org.hibernate.id.IdentifierGenerationException;
-import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
@@ -669,27 +668,17 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
}
@Override
- public Generator createGenerator(
- IdentifierGeneratorFactory identifierGeneratorFactory,
- Dialect dialect,
- RootClass rootClass) throws MappingException {
+ public Generator createGenerator(Dialect dialect, RootClass rootClass) throws MappingException {
if ( builtIdentifierGenerator == null ) {
- builtIdentifierGenerator = buildIdentifierGenerator(
- identifierGeneratorFactory,
- dialect,
- rootClass
- );
+ builtIdentifierGenerator = buildIdentifierGenerator( dialect, rootClass );
}
return builtIdentifierGenerator;
}
- private Generator buildIdentifierGenerator(
- IdentifierGeneratorFactory identifierGeneratorFactory,
- Dialect dialect,
- RootClass rootClass) throws MappingException {
+ private Generator buildIdentifierGenerator( Dialect dialect, RootClass rootClass) throws MappingException {
final boolean hasCustomGenerator = ! DEFAULT_ID_GEN_STRATEGY.equals( getIdentifierGeneratorStrategy() );
if ( hasCustomGenerator ) {
- return super.createGenerator( identifierGeneratorFactory, dialect, rootClass );
+ return super.createGenerator( dialect, rootClass );
}
final Class> entityClass = rootClass.getMappedClass();
@@ -724,7 +713,7 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
// skip any 'assigned' generators, they would have been handled by
// the StandardGenerationContextLocator
generator.addGeneratedValuePlan( new ValueGenerationPlan(
- value.createGenerator( identifierGeneratorFactory, dialect, rootClass ),
+ value.createGenerator( dialect, rootClass ),
getType().isMutable() ? injector( property, attributeDeclarer ) : null,
i
) );
diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/KeyValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/KeyValue.java
index 8904f6d895..0a42cf3db2 100644
--- a/hibernate-core/src/main/java/org/hibernate/mapping/KeyValue.java
+++ b/hibernate-core/src/main/java/org/hibernate/mapping/KeyValue.java
@@ -29,13 +29,10 @@ public interface KeyValue extends Value {
boolean isUpdateable();
- Generator createGenerator(
- IdentifierGeneratorFactory identifierGeneratorFactory,
- Dialect dialect,
- RootClass rootClass);
+ Generator createGenerator(Dialect dialect, RootClass rootClass);
/**
- * @deprecated Use {@link #createGenerator(IdentifierGeneratorFactory, Dialect, RootClass)} instead.
+ * @deprecated Use {@link #createGenerator(Dialect, RootClass)} instead.
* No longer used except in legacy tests.
*
* @return {@code null} if the {@code Generator} returned by {@link #createGenerator} is not an instance
@@ -48,12 +45,12 @@ public interface KeyValue extends Value {
String defaultCatalog,
String defaultSchema,
RootClass rootClass) {
- final Generator generator = createGenerator( identifierGeneratorFactory, dialect, rootClass );
+ final Generator generator = createGenerator( dialect, rootClass );
return generator instanceof IdentifierGenerator ? (IdentifierGenerator) generator : null;
}
/**
- * @deprecated Use {@link #createGenerator(IdentifierGeneratorFactory, Dialect, RootClass)} instead.
+ * @deprecated Use {@link #createGenerator(Dialect, RootClass)} instead.
* No longer used except in legacy tests.
*
* @return {@code null} if the {@code Generator} returned by {@link #createGenerator} is not an instance
@@ -64,7 +61,7 @@ public interface KeyValue extends Value {
IdentifierGeneratorFactory identifierGeneratorFactory,
Dialect dialect,
RootClass rootClass) {
- final Generator generator = createGenerator( identifierGeneratorFactory, dialect, rootClass );
+ final Generator generator = createGenerator( dialect, rootClass );
return generator instanceof IdentifierGenerator ? (IdentifierGenerator) generator : null;
}
}
diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java
index b0bb403044..d5cb6ce939 100644
--- a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java
+++ b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java
@@ -40,7 +40,6 @@ import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.Mapping;
import org.hibernate.generator.Generator;
import org.hibernate.id.IdentityGenerator;
-import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.id.factory.spi.CustomIdGeneratorCreationContext;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
@@ -391,14 +390,11 @@ public abstract class SimpleValue implements KeyValue {
}
@Override
- public Generator createGenerator(
- IdentifierGeneratorFactory identifierGeneratorFactory,
- Dialect dialect,
- RootClass rootClass) throws MappingException {
+ public Generator createGenerator(Dialect dialect, RootClass rootClass) throws MappingException {
if ( generator == null ) {
if ( customIdGeneratorCreator != null ) {
generator = customIdGeneratorCreator.createGenerator(
- new IdGeneratorCreationContext( identifierGeneratorFactory, null, null, rootClass )
+ new IdGeneratorCreationContext( null, null, rootClass )
);
}
else {
@@ -1104,23 +1100,16 @@ public abstract class SimpleValue implements KeyValue {
}
private class IdGeneratorCreationContext implements CustomIdGeneratorCreationContext {
- private final IdentifierGeneratorFactory identifierGeneratorFactory;
private final String defaultCatalog;
private final String defaultSchema;
private final RootClass rootClass;
- public IdGeneratorCreationContext(IdentifierGeneratorFactory identifierGeneratorFactory, String defaultCatalog, String defaultSchema, RootClass rootClass) {
- this.identifierGeneratorFactory = identifierGeneratorFactory;
+ public IdGeneratorCreationContext(String defaultCatalog, String defaultSchema, RootClass rootClass) {
this.defaultCatalog = defaultCatalog;
this.defaultSchema = defaultSchema;
this.rootClass = rootClass;
}
- @Override
- public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
- return identifierGeneratorFactory;
- }
-
@Override
public Database getDatabase() {
return buildingContext.getMetadataCollector().getDatabase();
diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
index ee3907d595..8dfb890655 100644
--- a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
+++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
@@ -639,11 +639,7 @@ public abstract class AbstractCollectionPersister
}
private BeforeExecutionGenerator createGenerator(RuntimeModelCreationContext context, IdentifierCollection collection) {
- final Generator generator = collection.getIdentifier().createGenerator(
- context.getBootstrapContext().getIdentifierGeneratorFactory(),
- context.getDialect(),
- null
- );
+ final Generator generator = collection.getIdentifier().createGenerator( context.getDialect(), null );
if ( generator.generatedOnExecution() ) {
throw new MappingException("must be an BeforeExecutionGenerator"); //TODO fix message
}
diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/userdefined/NativeGenerator.java b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/userdefined/NativeGenerator.java
index 6fb8a192a3..c6273dc6f9 100644
--- a/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/userdefined/NativeGenerator.java
+++ b/hibernate-core/src/test/java/org/hibernate/orm/test/idgen/userdefined/NativeGenerator.java
@@ -10,8 +10,9 @@ import org.hibernate.generator.EventType;
import org.hibernate.generator.Generator;
import org.hibernate.generator.OnExecutionGenerator;
import org.hibernate.id.Configurable;
+import org.hibernate.id.IdentityGenerator;
import org.hibernate.id.PostInsertIdentityPersister;
-import org.hibernate.id.factory.IdentifierGeneratorFactory;
+import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.id.factory.spi.CustomIdGeneratorCreationContext;
import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
import org.hibernate.service.ServiceRegistry;
@@ -24,16 +25,20 @@ import java.util.Properties;
public class NativeGenerator
implements OnExecutionGenerator, BeforeExecutionGenerator, Configurable, ExportableProducer {
- private final IdentifierGeneratorFactory factory;
- private final String strategy;
-
- private Generator generator;
+ private final Generator generator;
public NativeGenerator(NativeId nativeId, Member member, CustomIdGeneratorCreationContext creationContext) {
- factory = creationContext.getIdentifierGeneratorFactory();
- strategy = creationContext.getDatabase().getDialect().getNativeIdentifierGeneratorStrategy();
- if ( "identity".equals(strategy) ) {
- creationContext.getProperty().getValue().getColumns().get(0).setIdentity(true);
+ final String strategy = creationContext.getDatabase().getDialect().getNativeIdentifierGeneratorStrategy();
+ switch (strategy) {
+ case "sequence":
+ generator = new SequenceStyleGenerator();
+ break;
+ case "identity":
+ creationContext.getProperty().getValue().getColumns().get(0).setIdentity(true);
+ generator = new IdentityGenerator();
+ break;
+ default:
+ throw new IllegalArgumentException();
}
}
@@ -49,22 +54,9 @@ public class NativeGenerator
@Override
public void configure(Type type, Properties parameters, ServiceRegistry serviceRegistry) {
- generator = factory.createIdentifierGenerator(strategy, type, parameters);
- //TODO: should use this instead of the deprecated method, but see HHH-18135
-// GenerationType generationType;
-// switch (strategy) {
-// case "identity":
-// generationType = GenerationType.IDENTITY;
-// break;
-// case "sequence":
-// generationType = GenerationType.SEQUENCE;
-// break;
-// default:
-// throw new AssertionFailure("unrecognized strategy");
-// }
-// generator =
-// factory.createIdentifierGenerator( generationType, strategy, strategy, type.getJavaTypeDescriptor(),
-// parameters, (a, b) -> null );
+ if ( generator instanceof Configurable ) {
+ ((Configurable) generator).configure( type, parameters, serviceRegistry );
+ }
}
@Override