take out some @Deprecated trash

This commit is contained in:
Gavin King 2022-01-24 22:22:54 +01:00
parent bfde4461b3
commit 73f4960e3d
21 changed files with 16 additions and 419 deletions

View File

@ -146,7 +146,7 @@ public interface SessionBuilder<T extends SessionBuilder> {
* @see jakarta.persistence.PersistenceContextType
*
* @deprecated Only integrations can specify autoClosing behavior of
* individual sessions. See {@link org.hibernate.engine.spi.SessionOwner}.
* individual sessions.
*/
@Deprecated
T autoClose(boolean autoClose);

View File

@ -50,7 +50,7 @@ public @interface AttributeAccessor {
*
* @deprecated use {@link #strategy()}
*/
@Deprecated
@Deprecated(since = "6.0")
String value() default "";
/**
* A class implementing {@link PropertyAccessStrategy}.

View File

@ -21,8 +21,8 @@ public class BaselineSessionEventsListenerBuilder {
private static final SessionEventListener[] EMPTY = new SessionEventListener[0];
private boolean logSessionMetrics;
private Class<? extends SessionEventListener> autoListener;
private final boolean logSessionMetrics;
private final Class<? extends SessionEventListener> autoListener;
public BaselineSessionEventsListenerBuilder(
boolean logSessionMetrics,
@ -36,27 +36,11 @@ public class BaselineSessionEventsListenerBuilder {
return logSessionMetrics;
}
/**
* @deprecated this method will be removed as this builder should become immutable
*/
@Deprecated
public void setLogSessionMetrics(boolean logSessionMetrics) {
this.logSessionMetrics = logSessionMetrics;
}
@SuppressWarnings("UnusedDeclaration")
public Class<? extends SessionEventListener> getAutoListener() {
return autoListener;
}
/**
* @deprecated this method will be removed as this builder should become immutable
*/
@Deprecated
public void setAutoListener(Class<? extends SessionEventListener> autoListener) {
this.autoListener = autoListener;
}
public List<SessionEventListener> buildBaselineList() {
final SessionEventListener[] sessionEventListeners = buildBaseline();
//Capacity: needs to hold at least all elements from the baseline, but also expect to add a little more later.

View File

@ -23,11 +23,4 @@ public abstract class AbstractDelegatingSessionBuilderImplementor<T extends Sess
protected SessionBuilderImplementor delegate() {
return (SessionBuilderImplementor) super.delegate();
}
@SuppressWarnings({ "unchecked", "deprecation" })
@Override
public T owner(SessionOwner sessionOwner) {
delegate().owner( sessionOwner );
return (T) this;
}
}

View File

@ -17,16 +17,4 @@ import org.hibernate.SessionBuilder;
* @author Gail Badner
*/
public interface SessionBuilderImplementor<T extends SessionBuilder> extends SessionBuilder<T> {
/**
* Adds the session owner to the session options
*
* @param sessionOwner The session owner.
*
* @return {@code this}, for method chaining
*
* @deprecated since consolidating hibernate-entitymanager into hibernate-core
* I believe this is no longer needed.
*/
@Deprecated(since = "5.2")
T owner(SessionOwner sessionOwner);
}

View File

@ -1,37 +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.spi;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.AfterCompletionAction;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.ExceptionMapper;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.ManagedFlushChecker;
/**
* The contract for a Session owner. Typically this is something that wraps the Session.
*
* @author Gail Badner
*
* @see SessionBuilderImplementor#owner
*
* @deprecated since consolidating hibernate-entitymanager into hibernate-core
* I believe this is no longer needed.
*/
@Deprecated(since = "5.2")
public interface SessionOwner {
/**
* Should session automatically be closed after transaction completion?
*
* @return {@literal true}/{@literal false} appropriately.
*/
boolean shouldAutoCloseSession();
ExceptionMapper getExceptionMapper();
AfterCompletionAction getAfterCompletionAction();
ManagedFlushChecker getManagedFlushChecker();
}

View File

@ -266,12 +266,11 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
}
private StatementInspector interpret(StatementInspector statementInspector) {
if ( statementInspector == null ) {
return statementInspector == null
// If there is no StatementInspector specified, map to the call
// to the (deprecated) Interceptor#onPrepareStatement method
return interceptor::onPrepareStatement;
}
return statementInspector;
? interceptor::onPrepareStatement
: statementInspector;
}
@Override
@ -427,14 +426,6 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
}
}
/**
* @deprecated use {@link #checkOpen()} instead
*/
@Deprecated(since = "5.2")
protected void errorIfClosed() {
checkOpen();
}
@Override
public void markForRollbackOnly() {
try {

View File

@ -13,10 +13,8 @@ import java.util.TimeZone;
import org.hibernate.FlushMode;
import org.hibernate.Interceptor;
import org.hibernate.SessionEventListener;
import org.hibernate.engine.spi.SessionOwner;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.AfterCompletionAction;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.ExceptionMapper;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.ManagedFlushChecker;
@ -56,20 +54,7 @@ public interface SessionCreationOptions {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// deprecations
/**
* Access to the SessionOwner, which defines the contract for things that can wrap a Session
*
* @return Always returns null.
*
* @deprecated SessionOwner is no longer pertinent due to the
* hibernate-entitymanager -> hibernate-core consolidation
*/
@Deprecated(since = "5.2")
SessionOwner getSessionOwner();
ExceptionMapper getExceptionMapper();
AfterCompletionAction getAfterCompletionAction();
ManagedFlushChecker getManagedFlushChecker();
}

View File

@ -79,7 +79,6 @@ import org.hibernate.engine.profile.FetchProfile;
import org.hibernate.engine.spi.FilterDefinition;
import org.hibernate.engine.spi.SessionBuilderImplementor;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionOwner;
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
import org.hibernate.event.spi.EventEngine;
import org.hibernate.graph.spi.RootGraphImplementor;
@ -88,7 +87,6 @@ import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.integrator.spi.IntegratorService;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.jpa.internal.AfterCompletionActionLegacyJpaImpl;
import org.hibernate.jpa.internal.ExceptionMapperLegacyJpaImpl;
import org.hibernate.jpa.internal.ManagedFlushCheckerLegacyJpaImpl;
import org.hibernate.jpa.internal.PersistenceUnitUtilImpl;
@ -119,7 +117,6 @@ import org.hibernate.query.sql.spi.NativeQueryImplementor;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.AfterCompletionAction;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.ExceptionMapper;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.ManagedFlushChecker;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
@ -1202,11 +1199,6 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SessionCreationOptions
@Override
public SessionOwner getSessionOwner() {
return null;
}
@Override
public ExceptionMapper getExceptionMapper() {
return sessionOwnerBehavior == SessionOwnerBehavior.LEGACY_JPA
@ -1214,13 +1206,6 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
: null;
}
@Override
public AfterCompletionAction getAfterCompletionAction() {
return sessionOwnerBehavior == SessionOwnerBehavior.LEGACY_JPA
? AfterCompletionActionLegacyJpaImpl.INSTANCE
: null;
}
@Override
public ManagedFlushChecker getManagedFlushChecker() {
return sessionOwnerBehavior == SessionOwnerBehavior.LEGACY_JPA
@ -1292,11 +1277,6 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
return new SessionImpl( sessionFactory, this );
}
@Override
public T owner(SessionOwner sessionOwner) {
throw new UnsupportedOperationException( "SessionOwner was long deprecated and this method should no longer be invoked" );
}
@Override
@SuppressWarnings("unchecked")
public T interceptor(Interceptor interceptor) {
@ -1502,21 +1482,11 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
return null;
}
@Override
public SessionOwner getSessionOwner() {
return null;
}
@Override
public ExceptionMapper getExceptionMapper() {
return null;
}
@Override
public AfterCompletionAction getAfterCompletionAction() {
return null;
}
@Override
public ManagedFlushChecker getManagedFlushChecker() {
return null;

View File

@ -327,81 +327,6 @@ public final class ArrayHelper {
return PRIME_NUMER * seed + i;
}
/**
* Compare 2 arrays only at the first level
*
* @deprecated Use {@link Arrays#equals(Object[], Object[])} instead
*/
@Deprecated
public static boolean isEquals(Object[] o1, Object[] o2) {
if ( o1 == o2 ) {
return true;
}
if ( o1 == null || o2 == null ) {
return false;
}
int length = o1.length;
if ( length != o2.length ) {
return false;
}
for ( int index = 0; index < length; index++ ) {
if ( !o1[index].equals( o2[index] ) ) {
return false;
}
}
return true;
}
/**
* Compare 2 arrays only at the first level
*
* @deprecated Use {@link Arrays#equals(char[], char[])} instead
*/
@Deprecated
public static boolean isEquals(char[] o1, char[] o2) {
if ( o1 == o2 ) {
return true;
}
if ( o1 == null || o2 == null ) {
return false;
}
int length = o1.length;
if ( length != o2.length ) {
return false;
}
for ( int index = 0; index < length; index++ ) {
if ( !( o1[index] == o2[index] ) ) {
return false;
}
}
return true;
}
/**
* Compare 2 arrays only at the first level
*
* @deprecated Use {@link Arrays#equals(byte[], byte[])} instead
*/
@Deprecated
public static boolean isEquals(byte[] b1, byte[] b2) {
if ( b1 == b2 ) {
return true;
}
if ( b1 == null || b2 == null ) {
return false;
}
int length = b1.length;
if ( length != b2.length ) {
return false;
}
for ( int index = 0; index < length; index++ ) {
if ( !( b1[index] == b2[index] ) ) {
return false;
}
}
return true;
}
public static Serializable[] extractNonNull(Serializable[] array) {
final int nonNullCount = countNonNull( array );
final Serializable[] result = new Serializable[nonNullCount];

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.jpa.internal;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.AfterCompletionAction;
import org.jboss.logging.Logger;
/**
* @author Steve Ebersole
*/
public class AfterCompletionActionLegacyJpaImpl implements AfterCompletionAction {
private static final Logger log = Logger.getLogger( AfterCompletionActionLegacyJpaImpl.class );
/**
* Singleton access
*/
public static final AfterCompletionActionLegacyJpaImpl INSTANCE = new AfterCompletionActionLegacyJpaImpl();
@Override
public void doAction(boolean successful, SessionImplementor session) {
if ( session.isClosed() ) {
log.trace( "Session was closed; nothing to do" );
return;
}
if ( !successful && session.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta() ) {
session.clear();
}
}
}

View File

@ -2039,22 +2039,6 @@ public abstract class AbstractCollectionPersister
}
}
// /**
// * Process queued operations within the PersistentCollection.
// *
// * @param collection The collection
// * @param key The collection key
// * @param nextIndex The next index to write
// * @param session The session
// * @deprecated Use {@link #doProcessQueuedOps(PersistentCollection, Object, SharedSessionContractImplementor)}
// */
// @Deprecated
// protected void doProcessQueuedOps(PersistentCollection<?> collection, Object key,
// int nextIndex, SharedSessionContractImplementor session)
// throws HibernateException {
// doProcessQueuedOps( collection, key, session );
// }
protected abstract void doProcessQueuedOps(PersistentCollection<?> collection, Object key, SharedSessionContractImplementor session)
throws HibernateException;

View File

@ -4885,22 +4885,6 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getPropertyInsertability();
}
/**
* @deprecated no simple, direct replacement
*/
@Deprecated
public ValueInclusion[] getPropertyInsertGenerationInclusions() {
return null;
}
/**
* @deprecated no simple, direct replacement
*/
@Deprecated
public ValueInclusion[] getPropertyUpdateGenerationInclusions() {
return null;
}
public boolean[] getPropertyNullability() {
return entityMetamodel.getPropertyNullability();
}

View File

@ -127,22 +127,6 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
}
}
/**
* Only kept around for compatibility reasons since this seems to be API.
*
* @deprecated Use {@link #addPropertyPath(String, Type, String[], String[], String[], String[], Mapping)} instead
*/
@Deprecated
protected void addPropertyPath(
String path,
Type type,
String[] columns,
String[] columnReaders,
String[] columnReaderTemplates,
String[] formulaTemplates) {
addPropertyPath( path, type, columns, columnReaders, columnReaderTemplates, formulaTemplates, null );
}
protected void addPropertyPath(
String path,
Type type,

View File

@ -582,22 +582,6 @@ public interface EntityPersister
*/
boolean[] getPropertyInsertability();
/**
* Which of the properties of this class are database generated values on insert?
*
* @deprecated Replaced internally with InMemoryValueGenerationStrategy / InDatabaseValueGenerationStrategy
*/
@Deprecated
ValueInclusion[] getPropertyInsertGenerationInclusions();
/**
* Which of the properties of this class are database generated values on update?
*
* @deprecated Replaced internally with InMemoryValueGenerationStrategy / InDatabaseValueGenerationStrategy
*/
@Deprecated
ValueInclusion[] getPropertyUpdateGenerationInclusions();
/**
* Get the "updateability" of the properties of this class
* (does the property appear in an SQL UPDATE)

View File

@ -43,23 +43,9 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
private String sessionFactoryUuid;
private boolean allowLoadOutsideTransaction;
/**
* @deprecated This constructor was initially intended for serialization only, and is not useful anymore.
* In any case it should not be relied on by user code.
* Subclasses should rather implement Serializable with an {@code Object writeReplace()} method returning
* a subclass of {@link AbstractSerializableProxy},
* which in turn implements Serializable and an {@code Object readResolve()} method
* instantiating the {@link AbstractLazyInitializer} subclass
* and calling {@link AbstractSerializableProxy#afterDeserialization(AbstractLazyInitializer)} on it.
* See {@link org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor} and
* {@link org.hibernate.proxy.pojo.bytebuddy.SerializableProxy} for examples.
*/
@Deprecated
protected AbstractLazyInitializer() {
}
/**
* Main constructor.
*
* @param entityName The name of the entity being proxied.
* @param id The identifier of the entity being proxied.
* @param session The session owning the proxy.

View File

@ -14,27 +14,11 @@ import java.io.Serializable;
* @author Gail Badner
*/
public abstract class AbstractSerializableProxy implements Serializable {
private String entityName;
private Object id;
private Boolean readOnly;
private String sessionFactoryUuid;
private boolean allowLoadOutsideTransaction;
/**
* @deprecated This constructor was initially intended for serialization only, and is not useful anymore.
* In any case it should not be relied on by user code.
*/
@Deprecated
protected AbstractSerializableProxy() {
}
/**
* @deprecated use {@link #AbstractSerializableProxy(String, Object, Boolean, String, boolean)} instead.
*/
@Deprecated
protected AbstractSerializableProxy(String entityName, Serializable id, Boolean readOnly) {
this( entityName, id, readOnly, null, false );
}
private final String entityName;
private final Object id;
private final Boolean readOnly;
private final String sessionFactoryUuid;
private final boolean allowLoadOutsideTransaction;
protected AbstractSerializableProxy(
String entityName,
@ -57,23 +41,6 @@ public abstract class AbstractSerializableProxy implements Serializable {
return id;
}
/**
* Set the read-only/modifiable setting from this object in an AbstractLazyInitializer.
*
* This method should only be called during deserialization, before associating the
* AbstractLazyInitializer with a session.
*
* @param li the read-only/modifiable setting to use when
* associated with a session; null indicates that the default should be used.
* @throws IllegalStateException if isReadOnlySettingAvailable() == true
*
* @deprecated Use {@link #afterDeserialization(AbstractLazyInitializer)} instead.
*/
@Deprecated
protected void setReadOnlyBeforeAttachedToSession(AbstractLazyInitializer li) {
li.afterDeserialization( readOnly, null, false );
}
/**
* Initialize an {@link AbstractLazyInitializer} after deserialization.
*

View File

@ -1,26 +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.resource.transaction.backend.jta.internal.synchronization;
import java.io.Serializable;
import org.hibernate.engine.spi.SessionImplementor;
/**
* A pluggable strategy for defining any actions to be performed during
* {@link jakarta.transaction.Synchronization#afterCompletion} processing from the
* {@link jakarta.transaction.Synchronization} registered by Hibernate with the underlying JTA platform.
*
* @author Steve Ebersole
*
* @deprecated probably getting removed in 5.2 as well. This was an SPI contract
* intended for HEM that is no longer needed.
*/
@Deprecated(since = "5.2")
public interface AfterCompletionAction extends Serializable {
void doAction(boolean successful, SessionImplementor session);
}

View File

@ -425,16 +425,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
return new boolean[0];
}
@Override
public ValueInclusion[] getPropertyInsertGenerationInclusions() {
return new ValueInclusion[0];
}
@Override
public ValueInclusion[] getPropertyUpdateGenerationInclusions() {
return new ValueInclusion[0];
}
@Override
public boolean[] getPropertyUpdateability() {
return new boolean[0];

View File

@ -455,16 +455,6 @@ public class PersisterClassProviderTest {
return new boolean[0];
}
@Override
public ValueInclusion[] getPropertyInsertGenerationInclusions() {
return new ValueInclusion[0];
}
@Override
public ValueInclusion[] getPropertyUpdateGenerationInclusions() {
return new ValueInclusion[0];
}
@Override
public boolean[] getPropertyUpdateability() {
return new boolean[0];

View File

@ -628,15 +628,6 @@ public class CustomPersister implements EntityPersister {
return MUTABILITY;
}
public ValueInclusion[] getPropertyInsertGenerationInclusions() {
return new ValueInclusion[0];
}
public ValueInclusion[] getPropertyUpdateGenerationInclusions() {
return new ValueInclusion[0];
}
public boolean canExtractIdOutOfEntity() {
return true;
}