more removals of previously-deprecated stuff

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-05-31 15:46:01 +02:00 committed by Steve Ebersole
parent 7e536a269e
commit 5c29ed933e
28 changed files with 53 additions and 352 deletions

View File

@ -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()
);
}

View File

@ -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()
);
}

View File

@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
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 );
}
}

View File

@ -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();

View File

@ -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 );

View File

@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
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<String,TypedValue> filterParameters = new HashMap<>();
FilterKey(String name, Map<String,?> params, Map<String,Type> types) {
filterName = name;
for ( Map.Entry<String, ?> 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 + ']';
}
}

View File

@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
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 );
}
}

View File

@ -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()
);
}

View File

@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
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 {
}

View File

@ -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;

View File

@ -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;

View File

@ -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()
);
}

View File

@ -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;

View File

@ -255,14 +255,6 @@ public class OneToManyPersister extends AbstractCollectionPersister {
}
public boolean consumesEntityAlias() {
return true;
}
public boolean consumesCollectionAlias() {
return true;
}
public boolean isOneToMany() {
return true;
}

View File

@ -4301,16 +4301,6 @@ public abstract class AbstractEntityPersister
return false;
}
@Override
public boolean consumesEntityAlias() {
return true;
}
@Override
public boolean consumesCollectionAlias() {
return false;
}
/**
* {@inheritDoc}
*

View File

@ -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 {
}

View File

@ -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 );
}

View File

@ -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();
}

View File

@ -40,6 +40,4 @@ public interface SQLLoadable extends Loadable {
*/
Type getType();
}

View File

@ -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();
}
}

View File

@ -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;

View File

@ -160,9 +160,6 @@ public class ClobJavaType extends AbstractClassJavaType<Clob> {
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() );
}

View File

@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
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<byte[]>
implements VersionJavaType<byte[]> {
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> X unwrap(byte[] value, Class<X> 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 <X> 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;
}
}

View File

@ -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

View File

@ -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;

View File

@ -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();
}
}

View File

@ -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[] {""};

View File

@ -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);