add missing covariant overrides to SharedSessionBuilder

cc @jrenaat

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-05-22 00:06:22 +02:00
parent 8ea4d6a3c0
commit 8ceed5ab5a
2 changed files with 75 additions and 5 deletions

View File

@ -6,7 +6,11 @@
*/ */
package org.hibernate; package org.hibernate;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector;
import java.sql.Connection; import java.sql.Connection;
import java.util.TimeZone;
/** /**
* Specialized {@link SessionBuilder} with access to stuff from another session. * Specialized {@link SessionBuilder} with access to stuff from another session.
@ -67,8 +71,32 @@ public interface SharedSessionBuilder extends SessionBuilder {
*/ */
SharedSessionBuilder autoClose(); SharedSessionBuilder autoClose();
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @Override
// overrides to maintain binary compatibility SharedSessionBuilder statementInspector(StatementInspector statementInspector);
@Override
SharedSessionBuilder connectionHandlingMode(PhysicalConnectionHandlingMode mode);
@Override
SharedSessionBuilder autoClear(boolean autoClear);
@Override
SharedSessionBuilder flushMode(FlushMode flushMode);
@Override @Deprecated(forRemoval = true)
SharedSessionBuilder tenantIdentifier(String tenantIdentifier);
@Override
SharedSessionBuilder tenantIdentifier(Object tenantIdentifier);
@Override
SharedSessionBuilder eventListeners(SessionEventListener... listeners);
@Override
SharedSessionBuilder clearEventListeners();
@Override
SharedSessionBuilder jdbcTimeZone(TimeZone timeZone);
@Override @Override
SharedSessionBuilder interceptor(Interceptor interceptor); SharedSessionBuilder interceptor(Interceptor interceptor);

View File

@ -20,6 +20,7 @@ import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TimeZone;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.ConnectionAcquisitionMode; import org.hibernate.ConnectionAcquisitionMode;
@ -43,7 +44,6 @@ import org.hibernate.SessionEventListener;
import org.hibernate.SessionException; import org.hibernate.SessionException;
import org.hibernate.SharedSessionBuilder; import org.hibernate.SharedSessionBuilder;
import org.hibernate.SimpleNaturalIdLoadAccess; import org.hibernate.SimpleNaturalIdLoadAccess;
import org.hibernate.Transaction;
import org.hibernate.TransientObjectException; import org.hibernate.TransientObjectException;
import org.hibernate.TypeMismatchException; import org.hibernate.TypeMismatchException;
import org.hibernate.UnknownProfileException; import org.hibernate.UnknownProfileException;
@ -64,7 +64,6 @@ import org.hibernate.engine.spi.PersistentAttributeInterceptor;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.engine.transaction.spi.TransactionImplementor; import org.hibernate.engine.transaction.spi.TransactionImplementor;
import org.hibernate.engine.transaction.spi.TransactionObserver; import org.hibernate.engine.transaction.spi.TransactionObserver;
import org.hibernate.event.spi.EventManager; import org.hibernate.event.spi.EventManager;
@ -126,6 +125,7 @@ import org.hibernate.query.SelectionQuery;
import org.hibernate.query.UnknownSqlResultSetMappingException; import org.hibernate.query.UnknownSqlResultSetMappingException;
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner; import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl; import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl;
import org.hibernate.resource.transaction.spi.TransactionCoordinator; import org.hibernate.resource.transaction.spi.TransactionCoordinator;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
@ -2061,7 +2061,7 @@ public class SessionImpl
// SharedSessionBuilder // SharedSessionBuilder
@Override @Override @Deprecated
public SharedSessionBuilderImpl tenantIdentifier(String tenantIdentifier) { public SharedSessionBuilderImpl tenantIdentifier(String tenantIdentifier) {
// todo : is this always true? Or just in the case of sharing JDBC resources? // todo : is this always true? Or just in the case of sharing JDBC resources?
throw new SessionException( "Cannot redefine tenant identifier on child session" ); throw new SessionException( "Cannot redefine tenant identifier on child session" );
@ -2150,6 +2150,48 @@ public class SessionImpl
return this; return this;
} }
@Override
public SharedSessionBuilderImpl jdbcTimeZone(TimeZone timeZone) {
super.jdbcTimeZone(timeZone);
return this;
}
@Override
public SharedSessionBuilderImpl clearEventListeners() {
super.clearEventListeners();
return this;
}
@Override
public SharedSessionBuilderImpl flushMode(FlushMode flushMode) {
super.flushMode(flushMode);
return this;
}
@Override
public SharedSessionBuilderImpl autoClear(boolean autoClear) {
super.autoClear(autoClear);
return this;
}
@Override
public SharedSessionBuilderImpl statementInspector(StatementInspector statementInspector) {
super.statementInspector(statementInspector);
return this;
}
@Override
public SharedSessionBuilderImpl connectionHandlingMode(PhysicalConnectionHandlingMode connectionHandlingMode) {
super.connectionHandlingMode(connectionHandlingMode);
return this;
}
@Override
public SharedSessionBuilderImpl eventListeners(SessionEventListener... listeners) {
super.eventListeners(listeners);
return this;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SharedSessionCreationOptions // SharedSessionCreationOptions