Jrenaat 6.0 deprecation removals ()

* Removed deprecated org.hibernate.boot.jaxb.internal.stax.LocalSchema

Signed-off-by: Jan Schatteman <jschatte@redhat.com>

* Remove some deprecations from org.hibernate.engine.jdbc

Signed-off-by: Jan Schatteman <jschatte@redhat.com>

* Remove deprecated misspelled method in PostActionEventListener

Signed-off-by: Jan Schatteman <jschatte@redhat.com>

* Remove deprecated getSource() from AbstractPreDatabaseOperationEvent

Signed-off-by: Jan Schatteman <jschatte@redhat.com>

* Privatize deprecated buildOptimizer method in OptimizerFactory

Signed-off-by: Jan Schatteman <jschatte@redhat.com>

* Remove deprecated ServiceContributingIntegrator

Signed-off-by: Jan Schatteman <jschatte@redhat.com>

* Remove some more deprecated features

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2022-01-31 19:14:48 +01:00 committed by GitHub
parent 0ad5796ffd
commit d2b740ce5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 28 additions and 319 deletions

View File

@ -17,7 +17,7 @@ During the bootstrap process, you might want to customize Hibernate behavior so
=== Native Bootstrapping
This section discusses the process of bootstrapping a Hibernate `SessionFactory`.
Specifically, it addresses the bootstrapping APIs as redesigned in 5.0.
Specifically, it addresses the bootstrapping APIs.
For a discussion of the legacy bootstrapping API, see <<appendices/Legacy_Bootstrap.adoc#appendix-legacy-bootstrap,Legacy Bootstrapping>>.
[[bootstrap-native-registry]]
@ -86,8 +86,7 @@ include::{sourcedir}/BootstrapTest.java[tags=bootstrap-bootstrap-native-registry
[[bootstrap-event-listener-registration]]
==== Event Listener registration
The main use cases for an `org.hibernate.integrator.spi.Integrator` right now are registering event listeners and providing services (see `org.hibernate.integrator.spi.ServiceContributingIntegrator`).
With 5.0 we plan on expanding that to allow altering the metamodel describing the mapping between object and relational models.
The main use cases for an `org.hibernate.integrator.spi.Integrator` right now are registering event listeners.
[[bootstrap-event-listener-registration-example]]
.Configuring an event listener

View File

@ -75,20 +75,7 @@ public class DuplicateMappingException extends MappingException {
* @param name The name of the duplicated thing.
*/
public DuplicateMappingException(Type type, String name) {
this( type.text, name );
}
/**
* Creates a DuplicateMappingException using the given type and name.
*
* @param type The type of the duplicated thing.
* @param name The name of the duplicated thing.
*
* @deprecated Use the for taking {@link Type} instead.
*/
@Deprecated
public DuplicateMappingException(String type, String name) {
this( "Duplicate " + type + " mapping " + name, type, name );
this ( "Duplicate " + type.text + " mapping " + name, type, name );
}
/**
@ -99,23 +86,9 @@ public class DuplicateMappingException extends MappingException {
* @param name The name of the duplicated thing.
*/
public DuplicateMappingException(String customMessage, Type type, String name) {
this( customMessage, type.name(), name );
}
/**
* Creates a DuplicateMappingException using the given customMessage, type and name.
*
* @param customMessage A custom exception message explaining the exception condition
* @param type The type of the duplicated thing.
* @param name The name of the duplicated thing.
*
* @deprecated Use the for taking {@link Type} instead.
*/
@Deprecated
public DuplicateMappingException(String customMessage, String type, String name) {
super( customMessage );
this.type=type;
this.name=name;
this.type = type.name();
this.name = name;
}
public String getType() {

View File

@ -48,18 +48,6 @@ public class InstantiationException extends HibernateException {
this.clazz = clazz;
}
/**
* Returns the Class we were attempting to instantiate.
*
* @deprecated Use {@link #getUninstantiatableClass} instead
*
* @return The class we are unable to instantiate
*/
@Deprecated
public Class<?> getPersistentClass() {
return clazz;
}
/**
* Returns the Class we were attempting to instantiate.
*

View File

@ -137,12 +137,6 @@ public class JpaOrmXmlEventReader extends EventReaderDelegate {
private List<Namespace> mapNamespaces(Iterator<Namespace> originalNamespaceIterator ) {
final List<Namespace> mappedNamespaces = new ArrayList<>();
// final String elementNamespacePrefix = startElement.getName().getPrefix();
// if ( EMPTY_NAMESPACE_PREFIX.equals( elementNamespacePrefix ) ) {
// // add the default namespace mapping
// mappedNamespaces.add( xmlEventFactory.createNamespace( LocalSchema.ORM.getNamespaceUri() ) );
// }
while ( originalNamespaceIterator.hasNext() ) {
final Namespace originalNamespace = originalNamespaceIterator.next();
final Namespace mappedNamespace = mapNamespace( originalNamespace );

View File

@ -1,107 +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.boot.jaxb.internal.stax;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import javax.xml.XMLConstants;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.jboss.logging.Logger;
/**
* @author Steve Ebersole
*
* @deprecated No longer used locally. See {@link org.hibernate.boot.xsd.MappingXsdSupport}
* and {@link org.hibernate.boot.xsd.ConfigXsdSupport}
*/
@Deprecated
public enum LocalSchema {
ORM(
"http://www.hibernate.org/xsd/orm/mapping",
"org/hibernate/jpa/orm_2_1.xsd",
"2.1"
),
HBM(
"http://www.hibernate.org/xsd/orm/hbm",
"org/hibernate/xsd/mapping/legacy-mapping-4.0.xsd",
"4.0"
),
CFG(
"http://www.hibernate.org/xsd/orm/cfg",
"org/hibernate/hibernate-configuration-4.0.xsd",
"4.0"
)
;
private static final Logger log = Logger.getLogger( LocalSchema.class );
private final String namespaceUri;
private final String localResourceName;
private final String currentVersion;
private final Schema schema;
LocalSchema(String namespaceUri, String localResourceName, String currentVersion) {
this.namespaceUri = namespaceUri;
this.localResourceName = localResourceName;
this.currentVersion = currentVersion;
this.schema = resolveLocalSchema( localResourceName );
}
public String getNamespaceUri() {
return namespaceUri;
}
public String getCurrentVersion() {
return currentVersion;
}
public Schema getSchema() {
return schema;
}
private static Schema resolveLocalSchema(String schemaName) {
return resolveLocalSchema( resolveLocalSchemaUrl( schemaName ) );
}
private static URL resolveLocalSchemaUrl(String schemaName) {
URL url = LocalSchema.class.getClassLoader().getResource( schemaName );
if ( url == null ) {
throw new XmlInfrastructureException( "Unable to locate schema [" + schemaName + "] via classpath" );
}
return url;
}
private static Schema resolveLocalSchema(URL schemaUrl) {
try {
InputStream schemaStream = schemaUrl.openStream();
try {
StreamSource source = new StreamSource( schemaUrl.openStream() );
SchemaFactory schemaFactory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI );
return schemaFactory.newSchema( source );
}
catch (Exception e) {
throw new XmlInfrastructureException( "Unable to load schema [" + schemaUrl.toExternalForm() + "]", e );
}
finally {
try {
schemaStream.close();
}
catch (IOException e) {
log.debugf( "Problem closing schema stream - %s", e.toString() );
}
}
}
catch (IOException e) {
throw new XmlInfrastructureException( "Stream error handling schema url [" + schemaUrl.toExternalForm() + "]" );
}
}
}

View File

@ -20,8 +20,6 @@ import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Environment;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.integrator.spi.IntegratorService;
import org.hibernate.internal.util.PropertiesHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.Service;
@ -382,7 +380,6 @@ public class StandardServiceRegistryBuilder {
* @return A newly-instantiated {@link StandardServiceRegistry}
*/
public StandardServiceRegistry build() {
applyServiceContributingIntegrators();
applyServiceContributors();
final Map<String,Object> settingsCopy = new HashMap<>( settings );
@ -398,17 +395,6 @@ public class StandardServiceRegistryBuilder {
);
}
@SuppressWarnings("deprecation")
private void applyServiceContributingIntegrators() {
for ( Integrator integrator : bootstrapServiceRegistry.getService( IntegratorService.class )
.getIntegrators() ) {
if ( integrator instanceof org.hibernate.integrator.spi.ServiceContributingIntegrator ) {
( (org.hibernate.integrator.spi.ServiceContributingIntegrator) integrator )
.prepareServices(this );
}
}
}
private void applyServiceContributors() {
final Iterable<ServiceContributor> serviceContributors =
bootstrapServiceRegistry.getService( ClassLoaderService.class )

View File

@ -70,7 +70,7 @@ public class CollectionCacheInvalidator
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}

View File

@ -14,14 +14,6 @@ import java.sql.NClob;
* @author Steve Ebersole
*/
public interface WrappedNClob extends WrappedClob {
/**
* {@inheritDoc}
*
* @deprecated Use {@link #getWrappedNClob()} instead
*/
@Override
@Deprecated
NClob getWrappedClob();
/**
* Retrieve the wrapped {@link java.sql.Blob} reference

View File

@ -15,7 +15,6 @@ import java.sql.Statement;
import org.hibernate.engine.jdbc.batch.spi.Batch;
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
import org.hibernate.jdbc.WorkExecutorVisitable;
import org.hibernate.resource.jdbc.ResourceRegistry;
import org.hibernate.resource.jdbc.spi.LogicalConnectionImplementor;
import org.hibernate.resource.transaction.backend.jdbc.spi.JdbcResourceTransactionAccess;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner;
@ -27,12 +26,6 @@ import org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner;
* @author Brett Meyer
*/
public interface JdbcCoordinator extends Serializable, TransactionCoordinatorOwner, JdbcResourceTransactionAccess {
// /**
// * Retrieve the transaction coordinator associated with this JDBC coordinator.
// *
// * @return The transaction coordinator
// */
// public TransactionCoordinator getTransactionCoordinator();
/**
* Retrieves the logical connection associated with this JDBC coordinator.
@ -128,10 +121,10 @@ public interface JdbcCoordinator extends Serializable, TransactionCoordinatorOwn
/**
* Calculate the amount of time, in seconds, still remaining before transaction timeout occurs.
*
* @return The number of seconds remaining until until a transaction timeout occurs. A negative value indicates
* @return The number of seconds remaining until a transaction timeout occurs. A negative value indicates
* no timeout was requested.
*
* @throws org.hibernate.TransactionException Indicates the time out period has already been exceeded.
* @throws org.hibernate.TransactionException Indicates the timeout period has already been exceeded.
*/
int determineRemainingTransactionTimeOutPeriod();
@ -159,14 +152,6 @@ public interface JdbcCoordinator extends Serializable, TransactionCoordinatorOwn
*/
boolean isReadyForSerialization();
/**
* @deprecated access via {@link #getLogicalConnection} instead
*/
@Deprecated(since = "5.2")
default ResourceRegistry getResourceRegistry() {
return getLogicalConnection().getResourceRegistry();
}
void serialize(ObjectOutputStream objectOutputStream) throws IOException;
}

View File

@ -85,32 +85,10 @@ public class SqlStatementLogger {
return logToStdout;
}
/**
* Enable (true) or disable (false) logging to stdout.
*
* @param logToStdout True to enable logging to stdout; false to disable.
*
* @deprecated Will likely be removed:
* Should either become immutable or threadsafe.
*/
@Deprecated
public void setLogToStdout(boolean logToStdout) {
this.logToStdout = logToStdout;
}
public boolean isFormat() {
return format;
}
/**
* @deprecated Will likely be removed:
* Should either become immutable or threadsafe.
*/
@Deprecated
public void setFormat(boolean format) {
this.format = format;
}
public long getLogSlowQuery() {
return logSlowQuery;
}

View File

@ -32,7 +32,7 @@ public class PostDeleteEventListenerStandardImpl implements PostDeleteEventListe
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return callbackRegistry.hasRegisteredCallbacks( persister.getMappedClass(), CallbackType.POST_REMOVE );
}
}

View File

@ -32,7 +32,7 @@ public class PostInsertEventListenerStandardImpl implements PostInsertEventListe
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return callbackRegistry.hasRegisteredCallbacks( persister.getMappedClass(), CallbackType.POST_PERSIST );
}
}

View File

@ -41,7 +41,7 @@ public class PostUpdateEventListenerStandardImpl implements PostUpdateEventListe
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return callbackRegistry.hasRegisteredCallbacks( persister.getMappedClass(), CallbackType.POST_UPDATE );
}
}

View File

@ -64,21 +64,5 @@ public abstract class AbstractPreDatabaseOperationEvent extends AbstractEvent {
public EntityPersister getPersister() {
return persister;
}
/**
* Getter for property 'source'. This is the session from which the event
* originated.
* <p/>
* Some of the pre-* events had previous exposed the event source using
* getSource() because they had not originally extended from
* {@link AbstractEvent}.
*
* @return Value for property 'source'.
*
* @deprecated Use {@link #getSession} instead
*/
@Deprecated
public EventSource getSource() {
return getSession();
}
}

View File

@ -19,20 +19,6 @@ interface PostActionEventListener {
* @param persister The persister for the entity in question.
*
* @return {@code true} if after transaction callbacks should be added.
*
* @deprecated use {@link #requiresPostCommitHandling(EntityPersister)}
*/
@Deprecated
boolean requiresPostCommitHanding(EntityPersister persister);
/**
* Does this listener require that after transaction hooks be registered?
*
* @param persister The persister for the entity in question.
*
* @return {@code true} if after transaction callbacks should be added.
*/
default boolean requiresPostCommitHandling(EntityPersister persister) {
return requiresPostCommitHanding( persister );
}
boolean requiresPostCommitHandling(EntityPersister persister);
}

View File

@ -42,19 +42,7 @@ public class OptimizerFactory {
private static final Class[] CTOR_SIG = new Class[] { Class.class, int.class };
/**
* Builds an optimizer
*
* @param type The optimizer type, either a short-hand name or the {@link Optimizer} class name.
* @param returnClass The generated value java type
* @param incrementSize The increment size.
*
* @return The built optimizer
*
* @deprecated Use {@link #buildOptimizer(String, Class, int, long)} instead
*/
@Deprecated
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize) {
private static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize) {
final Class<? extends Optimizer> optimizerClass;
final StandardOptimizerDescriptor standardDescriptor = StandardOptimizerDescriptor.fromExternalName( type );

View File

@ -1,29 +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.integrator.spi;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
/**
* Additional, optional contract for Integrators that wish to contribute
* {@linkplain org.hibernate.service.Service services} to the Hibernate
* {@link org.hibernate.service.ServiceRegistry}.
*
* @author Steve Ebersole
*
* @deprecated A separate {@link org.hibernate.service.spi.ServiceContributor} should be used instead.
*/
@Deprecated
public interface ServiceContributingIntegrator extends Integrator {
/**
* Allow the integrator to alter the builder of {@link org.hibernate.service.ServiceRegistry}, presumably to
* register services into it.
*
* @param serviceRegistryBuilder The build to prepare.
*/
void prepareServices(StandardServiceRegistryBuilder serviceRegistryBuilder);
}

View File

@ -544,14 +544,6 @@ public final class StringHelper {
return string == null || string.isBlank();
}
/**
* @deprecated use {@link #isBlank(String)}
*/
@Deprecated
public static boolean isEmptyOrWhitespace(String string) {
return isBlank(string);
}
public static String qualify(String prefix, String name) {
if ( name == null || prefix == null ) {
throw new NullPointerException( "prefix or name were null attempting to build qualified name" );

View File

@ -54,7 +54,7 @@ public class LoadEntityWithElementCollectionTest {
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return false;
}

View File

@ -156,7 +156,7 @@ public class MergeListPreAndPostPersistTest extends BaseCoreFunctionalTestCase {
}
}
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return false;
}
}

View File

@ -165,7 +165,7 @@ public class MergeListPreAndPostPersistWithIdentityTest extends BaseCoreFunction
}
}
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return false;
}
}

View File

@ -226,7 +226,7 @@ public class LegacyPostCommitListenerTest extends BaseCoreFunctionalTestCase {
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}
}
@ -240,7 +240,7 @@ public class LegacyPostCommitListenerTest extends BaseCoreFunctionalTestCase {
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}
}
@ -254,7 +254,7 @@ public class LegacyPostCommitListenerTest extends BaseCoreFunctionalTestCase {
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}
}

View File

@ -241,7 +241,7 @@ public class PostCommitListenerTest extends BaseCoreFunctionalTestCase {
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}
}
@ -261,7 +261,7 @@ public class PostCommitListenerTest extends BaseCoreFunctionalTestCase {
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}
}
@ -281,7 +281,7 @@ public class PostCommitListenerTest extends BaseCoreFunctionalTestCase {
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}
}

View File

@ -205,7 +205,7 @@ public class SessionWithSharedConnectionTest {
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}
}

View File

@ -59,7 +59,7 @@ public class EnversPostDeleteEventListenerImpl extends BaseEnversEventListener i
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return getEnversService().getEntitiesConfigurations().isVersioned( persister.getEntityName() );
}
}

View File

@ -59,7 +59,7 @@ public class EnversPostInsertEventListenerImpl extends BaseEnversEventListener i
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return getEnversService().getEntitiesConfigurations().isVersioned( persister.getEntityName() );
}
}

View File

@ -85,7 +85,7 @@ public class EnversPostUpdateEventListenerImpl extends BaseEnversUpdateEventList
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return getEnversService().getEntitiesConfigurations().isVersioned( persister.getEntityName() );
}
}

View File

@ -79,7 +79,7 @@ public class RegisterUserEventListenersTest extends BaseEnversFunctionalTestCase
}
@Override
public boolean requiresPostCommitHanding(EntityPersister persister) {
public boolean requiresPostCommitHandling(EntityPersister persister) {
return true;
}