From f3329fe4e511b1a48f7baf3de22c4987e4be4d73 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sat, 1 Jun 2024 16:59:39 +0200 Subject: [PATCH] remove PostInsertIdentityPersister Signed-off-by: Gavin King --- .../identity/IdentityColumnSupport.java | 18 ---------- .../SybaseJconnIdentityColumnSupport.java | 2 -- .../generator/OnExecutionGenerator.java | 3 +- .../org/hibernate/id/IdentityGenerator.java | 5 +-- .../id/PostInsertIdentityPersister.java | 36 ------------------- .../entity/AbstractEntityPersister.java | 6 ++-- .../entity/DeprecatedEntityStuff.java | 4 +-- .../idgen/userdefined/NativeGenerator.java | 4 +-- 8 files changed, 10 insertions(+), 68 deletions(-) delete mode 100644 hibernate-core/src/main/java/org/hibernate/id/PostInsertIdentityPersister.java diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/identity/IdentityColumnSupport.java b/hibernate-core/src/main/java/org/hibernate/dialect/identity/IdentityColumnSupport.java index da057b80bb..e0460fc7cc 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/identity/IdentityColumnSupport.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/identity/IdentityColumnSupport.java @@ -8,7 +8,6 @@ package org.hibernate.dialect.identity; import org.hibernate.MappingException; import org.hibernate.dialect.Dialect; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.id.insert.GetGeneratedKeysDelegate; import org.hibernate.persister.entity.EntityPersister; @@ -124,23 +123,6 @@ public interface IdentityColumnSupport { 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 * {@link java.sql.PreparedStatement#getGeneratedKeys}. diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/identity/SybaseJconnIdentityColumnSupport.java b/hibernate-core/src/main/java/org/hibernate/dialect/identity/SybaseJconnIdentityColumnSupport.java index ba8b276711..9474f242a5 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/identity/SybaseJconnIdentityColumnSupport.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/identity/SybaseJconnIdentityColumnSupport.java @@ -6,8 +6,6 @@ */ 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.SybaseJConnGetGeneratedKeysDelegate; import org.hibernate.persister.entity.EntityPersister; diff --git a/hibernate-core/src/main/java/org/hibernate/generator/OnExecutionGenerator.java b/hibernate-core/src/main/java/org/hibernate/generator/OnExecutionGenerator.java index ba8db9ebb9..778a16195b 100644 --- a/hibernate-core/src/main/java/org/hibernate/generator/OnExecutionGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/generator/OnExecutionGenerator.java @@ -9,7 +9,6 @@ package org.hibernate.generator; import org.hibernate.Incubating; import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.id.insert.GetGeneratedKeysDelegate; import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate; 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. */ @Incubating - default InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister) { + default InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(EntityPersister persister) { final SessionFactoryImplementor factory = persister.getFactory(); final Dialect dialect = factory.getJdbcServices().getDialect(); if ( dialect.supportsInsertReturningGeneratedKeys() diff --git a/hibernate-core/src/main/java/org/hibernate/id/IdentityGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/IdentityGenerator.java index bb8cb35964..401ddde0c3 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/IdentityGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/IdentityGenerator.java @@ -15,6 +15,7 @@ import org.hibernate.id.insert.GetGeneratedKeysDelegate; import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate; import org.hibernate.id.insert.InsertReturningDelegate; import org.hibernate.id.insert.UniqueKeySelectingDelegate; +import org.hibernate.persister.entity.EntityPersister; import static org.hibernate.generator.EventType.INSERT; import static org.hibernate.generator.internal.NaturalIdHelper.getNaturalIdPropertyNames; @@ -52,7 +53,7 @@ public class IdentityGenerator } @Override - public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister) { + public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(EntityPersister persister) { final SessionFactoryImplementor factory = persister.getFactory(); final Dialect dialect = factory.getJdbcServices().getDialect(); // 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 else if ( sessionFactoryOptions.isGetGeneratedKeysEnabled() ) { - return dialect.getIdentityColumnSupport().buildGetGeneratedKeysDelegate( persister, dialect ); + return dialect.getIdentityColumnSupport().buildGetGeneratedKeysDelegate( persister ); } else if ( persister.getNaturalIdentifierProperties() != null && !persister.getEntityMetamodel().isNaturalIdentifierInsertGenerated() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/id/PostInsertIdentityPersister.java b/hibernate-core/src/main/java/org/hibernate/id/PostInsertIdentityPersister.java deleted file mode 100644 index d7189f8096..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/id/PostInsertIdentityPersister.java +++ /dev/null @@ -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 . - */ -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(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 47ad5d07e4..b39a21d79b 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -2248,17 +2248,17 @@ public abstract class AbstractEntityPersister } } - private DiscriminatorType discriminatorType; + private DiscriminatorType discriminatorType; - protected DiscriminatorType resolveDiscriminatorType() { + protected DiscriminatorType resolveDiscriminatorType() { if ( discriminatorType == null ) { discriminatorType = buildDiscriminatorType(); } return discriminatorType; } - private DiscriminatorType buildDiscriminatorType() { + private DiscriminatorType buildDiscriminatorType() { final BasicType underlingJdbcMapping = getDiscriminatorType(); if ( underlingJdbcMapping == null ) { return null; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/DeprecatedEntityStuff.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/DeprecatedEntityStuff.java index d4fc5dc4ee..0e773f1ab8 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/DeprecatedEntityStuff.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/DeprecatedEntityStuff.java @@ -7,11 +7,9 @@ package org.hibernate.persister.entity; -import org.hibernate.id.PostInsertIdentityPersister; - /** * @deprecated Just used to singly extend all the deprecated entity persister roles */ @Deprecated -public interface DeprecatedEntityStuff extends Loadable, Lockable, Queryable, PostInsertIdentityPersister { +public interface DeprecatedEntityStuff extends Loadable, Lockable, Queryable { } 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 4f713a8847..746bd98896 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 @@ -12,9 +12,9 @@ import org.hibernate.generator.GeneratorCreationContext; import org.hibernate.generator.OnExecutionGenerator; import org.hibernate.id.Configurable; import org.hibernate.id.IdentityGenerator; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.id.enhanced.SequenceStyleGenerator; import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate; +import org.hibernate.persister.entity.EntityPersister; import org.hibernate.service.ServiceRegistry; import org.hibernate.type.Type; @@ -94,7 +94,7 @@ public class NativeGenerator } @Override - public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister) { + public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(EntityPersister persister) { return ((OnExecutionGenerator) generator).getGeneratedIdentifierDelegate(persister); } }