remove PostInsertIdentityPersister

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-06-01 16:59:39 +02:00 committed by Steve Ebersole
parent 38d1a8bb83
commit f3329fe4e5
8 changed files with 10 additions and 68 deletions

View File

@ -8,7 +8,6 @@ package org.hibernate.dialect.identity;
import org.hibernate.MappingException; import org.hibernate.MappingException;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.id.PostInsertIdentityPersister;
import org.hibernate.id.insert.GetGeneratedKeysDelegate; import org.hibernate.id.insert.GetGeneratedKeysDelegate;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
@ -124,23 +123,6 @@ public interface IdentityColumnSupport {
return getIdentityInsertString() != null; return getIdentityInsertString() != null;
} }
/**
* The Delegate for dealing with IDENTITY columns using JDBC3 getGeneratedKeys
*
* @param persister The persister
* @param dialect The dialect against which to generate the delegate
*
* @return the dialect specific GetGeneratedKeys delegate
*
* @deprecated Use {@link #buildGetGeneratedKeysDelegate(EntityPersister)} instead.
*/
@Deprecated( forRemoval = true, since = "6.5" )
default GetGeneratedKeysDelegate buildGetGeneratedKeysDelegate(
PostInsertIdentityPersister persister,
Dialect dialect) {
return buildGetGeneratedKeysDelegate( persister );
}
/** /**
* The delegate for dealing with {@code IDENTITY} columns using * The delegate for dealing with {@code IDENTITY} columns using
* {@link java.sql.PreparedStatement#getGeneratedKeys}. * {@link java.sql.PreparedStatement#getGeneratedKeys}.

View File

@ -6,8 +6,6 @@
*/ */
package org.hibernate.dialect.identity; package org.hibernate.dialect.identity;
import org.hibernate.dialect.Dialect;
import org.hibernate.id.PostInsertIdentityPersister;
import org.hibernate.id.insert.GetGeneratedKeysDelegate; import org.hibernate.id.insert.GetGeneratedKeysDelegate;
import org.hibernate.id.insert.SybaseJConnGetGeneratedKeysDelegate; import org.hibernate.id.insert.SybaseJConnGetGeneratedKeysDelegate;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;

View File

@ -9,7 +9,6 @@ package org.hibernate.generator;
import org.hibernate.Incubating; import org.hibernate.Incubating;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.id.PostInsertIdentityPersister;
import org.hibernate.id.insert.GetGeneratedKeysDelegate; import org.hibernate.id.insert.GetGeneratedKeysDelegate;
import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate; import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
import org.hibernate.id.insert.InsertReturningDelegate; import org.hibernate.id.insert.InsertReturningDelegate;
@ -118,7 +117,7 @@ public interface OnExecutionGenerator extends Generator {
* identity columns is the reason why this layer-breaking method exists. * identity columns is the reason why this layer-breaking method exists.
*/ */
@Incubating @Incubating
default InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister) { default InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(EntityPersister persister) {
final SessionFactoryImplementor factory = persister.getFactory(); final SessionFactoryImplementor factory = persister.getFactory();
final Dialect dialect = factory.getJdbcServices().getDialect(); final Dialect dialect = factory.getJdbcServices().getDialect();
if ( dialect.supportsInsertReturningGeneratedKeys() if ( dialect.supportsInsertReturningGeneratedKeys()

View File

@ -15,6 +15,7 @@ import org.hibernate.id.insert.GetGeneratedKeysDelegate;
import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate; import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
import org.hibernate.id.insert.InsertReturningDelegate; import org.hibernate.id.insert.InsertReturningDelegate;
import org.hibernate.id.insert.UniqueKeySelectingDelegate; import org.hibernate.id.insert.UniqueKeySelectingDelegate;
import org.hibernate.persister.entity.EntityPersister;
import static org.hibernate.generator.EventType.INSERT; import static org.hibernate.generator.EventType.INSERT;
import static org.hibernate.generator.internal.NaturalIdHelper.getNaturalIdPropertyNames; import static org.hibernate.generator.internal.NaturalIdHelper.getNaturalIdPropertyNames;
@ -52,7 +53,7 @@ public class IdentityGenerator
} }
@Override @Override
public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister) { public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(EntityPersister persister) {
final SessionFactoryImplementor factory = persister.getFactory(); final SessionFactoryImplementor factory = persister.getFactory();
final Dialect dialect = factory.getJdbcServices().getDialect(); final Dialect dialect = factory.getJdbcServices().getDialect();
// Try to use generic delegates if the dialects supports them // Try to use generic delegates if the dialects supports them
@ -65,7 +66,7 @@ public class IdentityGenerator
} }
// Fall back to delegates which only handle identifiers // Fall back to delegates which only handle identifiers
else if ( sessionFactoryOptions.isGetGeneratedKeysEnabled() ) { else if ( sessionFactoryOptions.isGetGeneratedKeysEnabled() ) {
return dialect.getIdentityColumnSupport().buildGetGeneratedKeysDelegate( persister, dialect ); return dialect.getIdentityColumnSupport().buildGetGeneratedKeysDelegate( persister );
} }
else if ( persister.getNaturalIdentifierProperties() != null else if ( persister.getNaturalIdentifierProperties() != null
&& !persister.getEntityMetamodel().isNaturalIdentifierInsertGenerated() ) { && !persister.getEntityMetamodel().isNaturalIdentifierInsertGenerated() ) {

View File

@ -1,36 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* 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.id;
import org.hibernate.persister.entity.EntityPersister;
/**
* A persister that may have an identity assigned by execution of
* a SQL {@code INSERT}.
*
* @author Gavin King
* @deprecated Use {@link EntityPersister} instead.
*/
@Deprecated( forRemoval = true, since = "6.5" )
public interface PostInsertIdentityPersister extends EntityPersister {
@Override
String getIdentitySelectString();
@Override
String[] getIdentifierColumnNames();
@Override
String getSelectByUniqueKeyString(String propertyName);
@Override
default String getSelectByUniqueKeyString(String[] propertyNames) {
return EntityPersister.super.getSelectByUniqueKeyString( propertyNames );
}
@Override
String[] getRootTableKeyColumnNames();
}

View File

@ -2248,17 +2248,17 @@ public abstract class AbstractEntityPersister
} }
} }
private DiscriminatorType discriminatorType; private DiscriminatorType<?> discriminatorType;
protected DiscriminatorType resolveDiscriminatorType() { protected DiscriminatorType<?> resolveDiscriminatorType() {
if ( discriminatorType == null ) { if ( discriminatorType == null ) {
discriminatorType = buildDiscriminatorType(); discriminatorType = buildDiscriminatorType();
} }
return discriminatorType; return discriminatorType;
} }
private DiscriminatorType buildDiscriminatorType() { private DiscriminatorType<?> buildDiscriminatorType() {
final BasicType<?> underlingJdbcMapping = getDiscriminatorType(); final BasicType<?> underlingJdbcMapping = getDiscriminatorType();
if ( underlingJdbcMapping == null ) { if ( underlingJdbcMapping == null ) {
return null; return null;

View File

@ -7,11 +7,9 @@
package org.hibernate.persister.entity; package org.hibernate.persister.entity;
import org.hibernate.id.PostInsertIdentityPersister;
/** /**
* @deprecated Just used to singly extend all the deprecated entity persister roles * @deprecated Just used to singly extend all the deprecated entity persister roles
*/ */
@Deprecated @Deprecated
public interface DeprecatedEntityStuff extends Loadable, Lockable, Queryable, PostInsertIdentityPersister { public interface DeprecatedEntityStuff extends Loadable, Lockable, Queryable {
} }

View File

@ -12,9 +12,9 @@ import org.hibernate.generator.GeneratorCreationContext;
import org.hibernate.generator.OnExecutionGenerator; import org.hibernate.generator.OnExecutionGenerator;
import org.hibernate.id.Configurable; import org.hibernate.id.Configurable;
import org.hibernate.id.IdentityGenerator; import org.hibernate.id.IdentityGenerator;
import org.hibernate.id.PostInsertIdentityPersister;
import org.hibernate.id.enhanced.SequenceStyleGenerator; import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate; import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.Type; import org.hibernate.type.Type;
@ -94,7 +94,7 @@ public class NativeGenerator
} }
@Override @Override
public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister) { public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(EntityPersister persister) {
return ((OnExecutionGenerator) generator).getGeneratedIdentifierDelegate(persister); return ((OnExecutionGenerator) generator).getGeneratedIdentifierDelegate(persister);
} }
} }