From 5c29ed933ea394bcd9c468f2ce12d1442fe918ce Mon Sep 17 00:00:00 2001 From: Gavin King Date: Fri, 31 May 2024 15:46:01 +0200 Subject: [PATCH] more removals of previously-deprecated stuff Signed-off-by: Gavin King --- .../action/internal/EntityInsertAction.java | 4 +- .../action/internal/EntityUpdateAction.java | 4 +- .../internal/FailedSecondPassException.java | 30 ++++ .../InFlightMetadataCollectorImpl.java | 3 +- .../model/internal/AnnotatedJoinColumns.java | 4 +- .../org/hibernate/cache/spi/FilterKey.java | 61 -------- .../hibernate/cfg/RecoverableException.java | 38 ----- .../internal/NaturalIdResolutionsImpl.java | 4 +- .../transaction/spi/TransactionObserver.java | 16 -- .../org/hibernate/graph/GraphSemantic.java | 1 - .../org/hibernate/internal/SessionImpl.java | 2 +- .../ast/internal/CacheEntityLoaderHelper.java | 4 +- .../collection/BasicCollectionPersister.java | 10 -- .../collection/OneToManyPersister.java | 8 - .../entity/AbstractEntityPersister.java | 10 -- .../entity/DeprecatedEntityStuff.java | 2 +- .../persister/entity/EntityPersister.java | 4 +- .../hibernate/persister/entity/Joinable.java | 16 -- .../persister/entity/SQLLoadable.java | 2 - .../hibernate/stat/internal/StatsHelper.java | 14 +- .../stat/internal/StatsNamedContainer.java | 1 - .../type/descriptor/java/ClobJavaType.java | 3 - .../descriptor/java/RowVersionJavaType.java | 148 ------------------ .../common/JournalingTransactionObserver.java | 2 +- .../transaction/TransactionRollbackTest.java | 2 +- .../event/jfr/internal/JfrEventManager.java | 2 +- .../validation/MockCollectionPersister.java | 5 - .../validation/MockEntityPersister.java | 5 - 28 files changed, 53 insertions(+), 352 deletions(-) create mode 100644 hibernate-core/src/main/java/org/hibernate/boot/internal/FailedSecondPassException.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/cache/spi/FilterKey.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/cfg/RecoverableException.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionObserver.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/type/descriptor/java/RowVersionJavaType.java diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java index 4a7d17d6d9..e6bafdfff7 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java @@ -175,7 +175,7 @@ public class EntityInsertAction extends AbstractEntityInsertAction { final StatisticsImplementor statistics = factory.getStatistics(); if ( put && statistics.isStatisticsEnabled() ) { statistics.entityCachePut( - StatsHelper.INSTANCE.getRootEntityRole( persister ), + StatsHelper.getRootEntityRole( persister ), cache.getRegion().getName() ); } @@ -266,7 +266,7 @@ public class EntityInsertAction extends AbstractEntityInsertAction { final StatisticsImplementor statistics = factory.getStatistics(); if ( put && statistics.isStatisticsEnabled() ) { statistics.entityCachePut( - StatsHelper.INSTANCE.getRootEntityRole( persister ), + StatsHelper.getRootEntityRole( persister ), cache.getRegion().getName() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java index f84d96f9c0..68705cffbd 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java @@ -222,7 +222,7 @@ public class EntityUpdateAction extends EntityAction { final StatisticsImplementor statistics = session.getFactory().getStatistics(); if ( put && statistics.isStatisticsEnabled() ) { statistics.entityCachePut( - StatsHelper.INSTANCE.getRootEntityRole( persister ), + StatsHelper.getRootEntityRole( persister ), getPersister().getCacheAccessStrategy().getRegion().getName() ); } @@ -466,7 +466,7 @@ public class EntityUpdateAction extends EntityAction { final StatisticsImplementor statistics = session.getFactory().getStatistics(); if ( put && statistics.isStatisticsEnabled() ) { statistics.entityCachePut( - StatsHelper.INSTANCE.getRootEntityRole( getPersister() ), + StatsHelper.getRootEntityRole( getPersister() ), cache.getRegion().getName() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/FailedSecondPassException.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/FailedSecondPassException.java new file mode 100644 index 0000000000..62c3d17d85 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/FailedSecondPassException.java @@ -0,0 +1,30 @@ +/* + * 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.boot.internal; + +import org.hibernate.AnnotationException; + +/** + * Indicates a failure processing a {@link org.hibernate.boot.spi.SecondPass}, + * where the hope is that subsequent processing will be able to recover from it. + * + * @author Emmanuel Bernard + * + * @deprecated It would be nice to be able to eliminate this completely + */ +@Deprecated +public class FailedSecondPassException extends AnnotationException { + /** + * Constructs a FailedSecondPassException using the given message and underlying cause. + * + * @param msg The message explaining the condition that caused the exception + * @param cause The underlying exception + */ + public FailedSecondPassException(String msg, Throwable cause) { + super( msg, cause ); + } +} 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 b49acbfacf..0d99f9bcc6 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 @@ -80,7 +80,6 @@ import org.hibernate.boot.spi.NaturalIdUniqueKeyBinder; import org.hibernate.boot.spi.PropertyData; import org.hibernate.boot.spi.SecondPass; import org.hibernate.cfg.AvailableSettings; -import org.hibernate.cfg.RecoverableException; import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.FilterDefinition; import org.hibernate.engine.spi.SessionFactoryImplementor; @@ -2036,7 +2035,7 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector, try { pass.doSecondPass( getEntityBindingMap() ); } - catch (RecoverableException e) { + catch (FailedSecondPassException e) { failingSecondPasses.add( pass ); if ( originalException == null ) { originalException = (RuntimeException) e.getCause(); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AnnotatedJoinColumns.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AnnotatedJoinColumns.java index 73b692f863..ada2b3da0e 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AnnotatedJoinColumns.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AnnotatedJoinColumns.java @@ -16,6 +16,7 @@ import org.hibernate.AssertionFailure; import org.hibernate.MappingException; import org.hibernate.annotations.JoinColumnOrFormula; import org.hibernate.annotations.JoinFormula; +import org.hibernate.boot.internal.FailedSecondPassException; import org.hibernate.boot.model.naming.EntityNaming; import org.hibernate.boot.model.naming.Identifier; import org.hibernate.boot.model.naming.ImplicitJoinColumnNameSource; @@ -27,7 +28,6 @@ import org.hibernate.boot.spi.InFlightMetadataCollector; import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.boot.spi.MetadataBuildingOptions; import org.hibernate.boot.spi.PropertyData; -import org.hibernate.cfg.RecoverableException; import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.mapping.Column; @@ -324,7 +324,7 @@ public class AnnotatedJoinColumns extends AnnotatedColumns { // we throw a recoverable exception here in case this // is merely an ordering issue, so that the SecondPass // will get reprocessed later - throw new RecoverableException( me.getMessage(), me ); + throw new FailedSecondPassException( me.getMessage(), me ); } } final Table table = table( columnOwner ); diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/FilterKey.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/FilterKey.java deleted file mode 100644 index c168b101ee..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/FilterKey.java +++ /dev/null @@ -1,61 +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.cache.spi; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.hibernate.Remove; -import org.hibernate.engine.spi.TypedValue; -import org.hibernate.type.Type; - -/** - * Allows cached queries to be keyed by enabled filters. - * - * @author Gavin King - * - * @deprecated this class is no longer used - */ -@Deprecated(since = "6.2") @Remove -public final class FilterKey implements Serializable { - private final String filterName; - private final Map filterParameters = new HashMap<>(); - - FilterKey(String name, Map params, Map types) { - filterName = name; - for ( Map.Entry paramEntry : params.entrySet() ) { - final Type type = types.get( paramEntry.getKey() ); - filterParameters.put( paramEntry.getKey(), new TypedValue( type, paramEntry.getValue() ) ); - } - } - - @Override - public int hashCode() { - int result = 13; - result = 37 * result + filterName.hashCode(); - result = 37 * result + filterParameters.hashCode(); - return result; - } - - @Override - public boolean equals(Object other) { - if ( !(other instanceof FilterKey) ) { - return false; - } - - final FilterKey that = (FilterKey) other; - return that.filterName.equals( filterName ) - && that.filterParameters.equals( filterParameters ); - } - - @Override - public String toString() { - return "FilterKey[" + filterName + filterParameters + ']'; - } - -} diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/RecoverableException.java b/hibernate-core/src/main/java/org/hibernate/cfg/RecoverableException.java deleted file mode 100644 index 68918ff061..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cfg/RecoverableException.java +++ /dev/null @@ -1,38 +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.cfg; - -import org.hibernate.AnnotationException; - -/** - * An exception that indicates a condition where the hope is that subsequent processing will be able to - * recover from it. - * - * @deprecated Was only ever referenced in a single place, in an extremely dubious way. - * - * @author Emmanuel Bernard - */ -@Deprecated -public class RecoverableException extends AnnotationException { - /** - * Constructs a RecoverableException using the given message and underlying cause. - * - * @param msg The message explaining the condition that caused the exception - * @param cause The underlying exception - */ - public RecoverableException(String msg, Throwable cause) { - super( msg, cause ); - } - - /** - * Constructs a RecoverableException using the given message and underlying cause. - * - */ - public RecoverableException(String msg) { - super( msg ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java index e0eccd2d8c..77e51f2e3d 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java @@ -655,7 +655,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa if ( pk != null ) { if ( statisticsEnabled ) { statistics.naturalIdCacheHit( - StatsHelper.INSTANCE.getRootEntityRole( persister ), + StatsHelper.getRootEntityRole( persister ), naturalIdCacheAccessStrategy.getRegion().getName() ); } @@ -683,7 +683,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa } else if ( statisticsEnabled ) { statistics.naturalIdCacheMiss( - StatsHelper.INSTANCE.getRootEntityRole( persister ), + StatsHelper.getRootEntityRole( persister ), naturalIdCacheAccessStrategy.getRegion().getName() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionObserver.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionObserver.java deleted file mode 100644 index 5d33d4a321..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionObserver.java +++ /dev/null @@ -1,16 +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.engine.transaction.spi; - -/** - * @author Steve Ebersole - * - * @deprecated use {@link org.hibernate.resource.transaction.spi.TransactionObserver} - */ -@Deprecated(since = "6") -public interface TransactionObserver extends org.hibernate.resource.transaction.spi.TransactionObserver { -} diff --git a/hibernate-core/src/main/java/org/hibernate/graph/GraphSemantic.java b/hibernate-core/src/main/java/org/hibernate/graph/GraphSemantic.java index d6357aa794..a3c06af4f2 100644 --- a/hibernate-core/src/main/java/org/hibernate/graph/GraphSemantic.java +++ b/hibernate-core/src/main/java/org/hibernate/graph/GraphSemantic.java @@ -9,7 +9,6 @@ package org.hibernate.graph; import java.util.Locale; import org.hibernate.AssertionFailure; -import org.hibernate.jpa.LegacySpecHints; import static org.hibernate.jpa.LegacySpecHints.HINT_JAVAEE_FETCH_GRAPH; import static org.hibernate.jpa.LegacySpecHints.HINT_JAVAEE_LOAD_GRAPH; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index a193cb8d09..c495b3a7cc 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -70,7 +70,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.transaction.spi.TransactionImplementor; -import org.hibernate.engine.transaction.spi.TransactionObserver; +import org.hibernate.resource.transaction.spi.TransactionObserver; import org.hibernate.event.spi.EventManager; import org.hibernate.event.spi.HibernateMonitoringEvent; import org.hibernate.event.spi.AutoFlushEvent; diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/CacheEntityLoaderHelper.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/CacheEntityLoaderHelper.java index 833cc62b96..43ce559f5c 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/CacheEntityLoaderHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/CacheEntityLoaderHelper.java @@ -277,13 +277,13 @@ public class CacheEntityLoaderHelper { if ( statistics.isStatisticsEnabled() ) { if ( ce == null ) { statistics.entityCacheMiss( - StatsHelper.INSTANCE.getRootEntityRole( persister ), + StatsHelper.getRootEntityRole( persister ), cache.getRegion().getName() ); } else { statistics.entityCacheHit( - StatsHelper.INSTANCE.getRootEntityRole( persister ), + StatsHelper.getRootEntityRole( persister ), cache.getRegion().getName() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java index e948281080..0d43948d1f 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java @@ -753,16 +753,6 @@ public class BasicCollectionPersister extends AbstractCollectionPersister { } } - @Override - public boolean consumesEntityAlias() { - return false; - } - - @Override - public boolean consumesCollectionAlias() { - return true; - } - @Override public boolean isOneToMany() { return false; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java index 7c6d6d9a00..04977302c2 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java @@ -255,14 +255,6 @@ public class OneToManyPersister extends AbstractCollectionPersister { } - public boolean consumesEntityAlias() { - return true; - } - - public boolean consumesCollectionAlias() { - return true; - } - public boolean isOneToMany() { return true; } 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 723329292e..76da1a2779 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 @@ -4301,16 +4301,6 @@ public abstract class AbstractEntityPersister return false; } - @Override - public boolean consumesEntityAlias() { - return true; - } - - @Override - public boolean consumesCollectionAlias() { - return false; - } - /** * {@inheritDoc} * 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 e3a42a8e68..8bc2652ba2 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 @@ -13,5 +13,5 @@ import org.hibernate.metadata.ClassMetadata; */ @Deprecated public interface DeprecatedEntityStuff - extends OuterJoinLoadable, ClassMetadata, UniqueKeyLoadable, SQLLoadable, Lockable, org.hibernate.persister.entity.Queryable { + extends OuterJoinLoadable, ClassMetadata, UniqueKeyLoadable, SQLLoadable, Lockable, Queryable { } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java index a86e5f133d..6228a8eff1 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java @@ -249,7 +249,10 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget * entity spaces. * * @return The synchronization spaces. + * + * @deprecated No longer called */ + @Deprecated(since = "7.0", forRemoval = true) default String[] getSynchronizationSpaces() { return (String[]) getQuerySpaces(); } @@ -1222,7 +1225,6 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget FilterAliasGenerator getFilterAliasGenerator(final String rootAlias); default FilterAliasGenerator getFilterAliasGenerator(TableGroup rootTableGroup) { - assert this instanceof Joinable; return new TableGroupFilterAliasGenerator( ( (Joinable) this ).getTableName(), rootTableGroup ); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/Joinable.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/Joinable.java index b400b8ac24..8519dac13a 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/Joinable.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/Joinable.java @@ -41,20 +41,4 @@ public interface Joinable extends Restrictable { * Is this instance actually a CollectionPersister? */ boolean isCollection(); - - /** - * Very, very, very ugly... - * - * @return Does this persister "consume" entity column aliases in the result - * set? - */ - boolean consumesEntityAlias(); - - /** - * Very, very, very ugly... - * - * @return Does this persister "consume" collection column aliases in the result - * set? - */ - boolean consumesCollectionAlias(); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SQLLoadable.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SQLLoadable.java index ed4690c6cc..e6a6b0ac11 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SQLLoadable.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SQLLoadable.java @@ -40,6 +40,4 @@ public interface SQLLoadable extends Loadable { */ Type getType(); - - } diff --git a/hibernate-core/src/main/java/org/hibernate/stat/internal/StatsHelper.java b/hibernate-core/src/main/java/org/hibernate/stat/internal/StatsHelper.java index 0d44a41392..074a7084b1 100644 --- a/hibernate-core/src/main/java/org/hibernate/stat/internal/StatsHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/stat/internal/StatsHelper.java @@ -15,22 +15,16 @@ import org.hibernate.persister.entity.EntityPersister; * @author Steve Ebersole */ public class StatsHelper { - /** - * Singleton access - */ - public static final StatsHelper INSTANCE = new StatsHelper(); - public NavigableRole getRootEntityRole(EntityPersister entityDescriptor) { + public static NavigableRole getRootEntityRole(EntityPersister entityDescriptor) { final String rootEntityName = entityDescriptor.getRootEntityName(); if ( entityDescriptor.getEntityName().equals( rootEntityName ) ) { return entityDescriptor.getNavigableRole(); } else { - final EntityPersister rootEntityDescriptor = entityDescriptor.getFactory() - .getRuntimeMetamodels() - .getMappingMetamodel() - .getEntityDescriptor( rootEntityName ); - return rootEntityDescriptor.getNavigableRole(); + return entityDescriptor.getFactory().getMappingMetamodel() + .getEntityDescriptor( rootEntityName ) + .getNavigableRole(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/stat/internal/StatsNamedContainer.java b/hibernate-core/src/main/java/org/hibernate/stat/internal/StatsNamedContainer.java index bf72f93125..dfb3f1fbcb 100644 --- a/hibernate-core/src/main/java/org/hibernate/stat/internal/StatsNamedContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/stat/internal/StatsNamedContainer.java @@ -10,7 +10,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.function.Function; -import org.hibernate.internal.util.NullnessUtil; import org.hibernate.internal.util.collections.BoundedConcurrentHashMap; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ClobJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ClobJavaType.java index b1248a76da..a86bebe920 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ClobJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ClobJavaType.java @@ -160,9 +160,6 @@ public class ClobJavaType extends AbstractClassJavaType { Reader reader = (Reader) value; return options.getLobCreator().createClob( DataHelper.extractString( reader ) ); } - else if ( String.class.isAssignableFrom( value.getClass() ) ) { - return options.getLobCreator().createClob( (String) value ); - } throw unknownWrap( value.getClass() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/RowVersionJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/RowVersionJavaType.java deleted file mode 100644 index f91c76929c..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/RowVersionJavaType.java +++ /dev/null @@ -1,148 +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.type.descriptor.java; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.sql.Blob; -import java.sql.SQLException; -import java.util.Arrays; - -import org.hibernate.HibernateException; -import org.hibernate.engine.jdbc.BinaryStream; -import org.hibernate.engine.jdbc.internal.BinaryStreamImpl; -import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.internal.util.compare.RowVersionComparator; -import org.hibernate.type.descriptor.WrapperOptions; - -/** - * Descriptor for {@code byte[]} handling specifically used for specifically for entity versions/timestamps. - * - * @author Steve Ebersole - * @author Gail Badner - * - * @deprecated No longer used - */ -@Deprecated(since = "6") -public class RowVersionJavaType extends AbstractClassJavaType - implements VersionJavaType { - public static final RowVersionJavaType INSTANCE = new RowVersionJavaType(); - - @SuppressWarnings("unchecked") - public RowVersionJavaType() { - super( byte[].class, ArrayMutabilityPlan.INSTANCE, RowVersionComparator.INSTANCE ); - } - - @Override - public boolean areEqual(byte[] one, byte[] another) { - return one == another - || ( one != null && another != null && Arrays.equals( one, another ) ); - } - - @Override - public int extractHashCode(byte[] bytes) { - int hashCode = 1; - for ( byte aByte : bytes ) { - hashCode = 31 * hashCode + aByte; - } - return hashCode; - } - - public String toString(byte[] bytes) { - final StringBuilder buf = new StringBuilder( bytes.length * 2 ); - for ( byte aByte : bytes ) { - final String hexStr = Integer.toHexString( aByte - Byte.MIN_VALUE ); - if ( hexStr.length() == 1 ) { - buf.append( '0' ); - } - buf.append( hexStr ); - } - return buf.toString(); - } - - @Override - public String extractLoggableRepresentation(byte[] value) { - return (value == null) ? super.extractLoggableRepresentation( null ) : Arrays.toString( value ); - } - - public byte[] fromString(CharSequence string) { - if ( string == null ) { - return null; - } - if ( string.length() % 2 != 0 ) { - throw new IllegalArgumentException( "The string is not a valid string representation of a binary content." ); - } - byte[] bytes = new byte[string.length() / 2]; - for ( int i = 0; i < bytes.length; i++ ) { - final String hexStr = string.subSequence( i * 2, (i + 1) * 2 ).toString(); - bytes[i] = (byte) (Integer.parseInt(hexStr, 16) + Byte.MIN_VALUE); - } - return bytes; - } - - @SuppressWarnings("unchecked") - public X unwrap(byte[] value, Class type, WrapperOptions options) { - if ( value == null ) { - return null; - } - if ( byte[].class.isAssignableFrom( type ) ) { - return (X) value; - } - if ( InputStream.class.isAssignableFrom( type ) ) { - return (X) new ByteArrayInputStream( value ); - } - if ( BinaryStream.class.isAssignableFrom( type ) ) { - return (X) new BinaryStreamImpl( value ); - } - if ( Blob.class.isAssignableFrom( type ) ) { - return (X) options.getLobCreator().createBlob( value ); - } - - throw unknownUnwrap( type ); - } - - public byte[] wrap(X value, WrapperOptions options) { - if ( value == null ) { - return null; - } - if (value instanceof byte[]) { - return (byte[]) value; - } - if (value instanceof InputStream) { - return DataHelper.extractBytes( (InputStream) value ); - } - if ( value instanceof Blob || DataHelper.isNClob( value.getClass() ) ) { - try { - return DataHelper.extractBytes( ( (Blob) value ).getBinaryStream() ); - } - catch ( SQLException e ) { - throw new HibernateException( "Unable to access lob stream", e ); - } - } - - throw unknownWrap( value.getClass() ); - } - - @Override - public byte[] seed( - Long length, Integer precision, Integer scale, SharedSessionContractImplementor session) { - // Note : simply returns null for seed() and next() as the only known - // application of binary types for versioning is for use with the - // TIMESTAMP datatype supported by Sybase and SQL Server, which - // are completely db-generated values... - return null; - } - - @Override - public byte[] next( - byte[] current, - Long length, - Integer precision, - Integer scale, SharedSessionContractImplementor session) { - return current; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/common/JournalingTransactionObserver.java b/hibernate-core/src/test/java/org/hibernate/orm/test/common/JournalingTransactionObserver.java index 6b653dcbd0..dde0c749b8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/common/JournalingTransactionObserver.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/common/JournalingTransactionObserver.java @@ -6,7 +6,7 @@ */ package org.hibernate.orm.test.common; -import org.hibernate.engine.transaction.spi.TransactionObserver; +import org.hibernate.resource.transaction.spi.TransactionObserver; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/transaction/TransactionRollbackTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/transaction/TransactionRollbackTest.java index 013e6647d9..47f73ed3dd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/transaction/TransactionRollbackTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/transaction/TransactionRollbackTest.java @@ -11,7 +11,7 @@ import jakarta.persistence.Id; import jakarta.persistence.Version; import org.hibernate.Session; -import org.hibernate.engine.transaction.spi.TransactionObserver; +import org.hibernate.resource.transaction.spi.TransactionObserver; import org.hibernate.resource.jdbc.spi.JdbcSessionOwner; import org.hibernate.testing.TestForIssue; diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventManager.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventManager.java index 992846428c..fec0396b6f 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventManager.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventManager.java @@ -533,6 +533,6 @@ public class JfrEventManager implements EventManager { } private String getEntityName(EntityPersister persister) { - return StatsHelper.INSTANCE.getRootEntityRole( persister ).getFullPath(); + return StatsHelper.getRootEntityRole( persister ).getFullPath(); } } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockCollectionPersister.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockCollectionPersister.java index 7ac32c7a54..fdf735586e 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockCollectionPersister.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockCollectionPersister.java @@ -198,11 +198,6 @@ public abstract class MockCollectionPersister implements QueryableCollection { return true; } - @Override - public boolean consumesCollectionAlias() { - return true; - } - @Override public String[] toColumns(String propertyName) { return new String[] {""}; diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockEntityPersister.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockEntityPersister.java index db099edb18..daef961754 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockEntityPersister.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockEntityPersister.java @@ -227,11 +227,6 @@ public abstract class MockEntityPersister implements EntityPersister, Queryable, return null; } - @Override - public boolean consumesEntityAlias() { - return true; - } - @Override public Type getDiscriminatorType() { return typeConfiguration.getBasicTypeForJavaType(String.class);