Removal @Deprecated from availablesettings (#4369)

* Remove deprecated *_CLASSLOADER from AvailableSettings

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

* Remove deprecated HBM2DLL_CREATE_NAMESPACES and DEPRECATED_EXTRA_PHYSICAL_TABLE_TYPES from AvailableSettings

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

* Remove deprecated and duplicated HBM2DDL_DB_NAME, HBM2DDL_DB_VERSION, HBM2DDL_DB_MAJOR_VERSION, HBM2DDL_DB_MINOR_VERSION from AvailableSettings

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2021-11-17 14:52:52 +01:00 committed by GitHub
parent e1354b3a81
commit 69d2c65880
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 123 deletions

View File

@ -1062,23 +1062,11 @@ The property name defines the role (e.g. `allowed`) and the entity class name (e
A String identifying the policy context whose PolicyConfiguration interface is to be returned. The value passed to this parameter must not be null.
[[configurations-classloader]]
=== ClassLoaders properties
=== ClassLoaders property
`*hibernate.classLoaders*`::
Used to define a `java.util.Collection<ClassLoader>` or the `ClassLoader` instance Hibernate should use for class-loading and resource-lookups.
`*hibernate.classLoader.application*`::
Names the `ClassLoader` used to load user application classes.
`*hibernate.classLoader.resources*`::
Names the `ClassLoader` Hibernate should use to perform resource loading.
`*hibernate.classLoader.hibernate*`::
Names the `ClassLoader` responsible for loading Hibernate classes. By default, this is the `ClassLoader` that loaded this class.
`*hibernate.classLoader.environment*`::
Names the `ClassLoader` used when Hibernate is unable to locates classes on the `hibernate.classLoader.application` or `hibernate.classLoader.hibernate`.
[[configurations-bootstrap]]
=== Bootstrap properties

View File

@ -108,11 +108,6 @@ public class ClassLoaderServiceImpl implements ClassLoaderService {
providedClassLoaders.addAll( classLoaders );
}
addIfSet( providedClassLoaders, AvailableSettings.APP_CLASSLOADER, configValues );
addIfSet( providedClassLoaders, AvailableSettings.RESOURCES_CLASSLOADER, configValues );
addIfSet( providedClassLoaders, AvailableSettings.HIBERNATE_CLASSLOADER, configValues );
addIfSet( providedClassLoaders, AvailableSettings.ENVIRONMENT_CLASSLOADER, configValues );
return new ClassLoaderServiceImpl( providedClassLoaders,TcclLookupPrecedence.AFTER );
}

View File

@ -234,41 +234,6 @@ public interface AvailableSettings {
*/
String TC_CLASSLOADER = "hibernate.classLoader.tccl_lookup_precedence";
/**
* Names the {@link ClassLoader} used to load user application classes.
* @since 4.0
*
* @deprecated Use {@link #CLASSLOADERS} instead
*/
@Deprecated
String APP_CLASSLOADER = "hibernate.classLoader.application";
/**
* Names the {@link ClassLoader} Hibernate should use to perform resource loading.
* @since 4.0
* @deprecated Use {@link #CLASSLOADERS} instead
*/
@Deprecated
String RESOURCES_CLASSLOADER = "hibernate.classLoader.resources";
/**
* Names the {@link ClassLoader} responsible for loading Hibernate classes. By default this is
* the {@link ClassLoader} that loaded this class.
* @since 4.0
* @deprecated Use {@link #CLASSLOADERS} instead
*/
@Deprecated
String HIBERNATE_CLASSLOADER = "hibernate.classLoader.hibernate";
/**
* Names the {@link ClassLoader} used when Hibernate is unable to locate classes on the
* {@link #APP_CLASSLOADER} or {@link #HIBERNATE_CLASSLOADER}.
* @since 4.0
* @deprecated Use {@link #CLASSLOADERS} instead
*/
@Deprecated
String ENVIRONMENT_CLASSLOADER = "hibernate.classLoader.environment";
/**
* Setting that controls whether we seek out JPA "static metamodel" classes and populate them. Accepts
* 3 values:<ul>
@ -1365,30 +1330,6 @@ public interface AvailableSettings {
@Deprecated
String HBM2DDL_CONNECTION = "javax.persistence.schema-generation-connection";
/**
* @deprecated Use {@link #DIALECT_DB_NAME} instead
*/
@Deprecated
String HBM2DDL_DB_NAME = DIALECT_DB_NAME;
/**
* @deprecated Use {@link #DIALECT_DB_VERSION} instead
*/
@Deprecated
String HBM2DDL_DB_VERSION = "javax.persistence.database-product-version";
/**
* @deprecated Use {@link #DIALECT_DB_MAJOR_VERSION} instead
*/
@Deprecated
String HBM2DDL_DB_MAJOR_VERSION = "javax.persistence.database-major-version";
/**
* @deprecated Use {@link #DIALECT_DB_MINOR_VERSION} instead
*/
@Deprecated
String HBM2DDL_DB_MINOR_VERSION = "javax.persistence.database-minor-version";
/**
* Specifies whether schema generation commands for schema creation are to be determined based on object/relational
* mapping metadata, DDL scripts, or a combination of the two. See {@link SourceType} for valid set of values.
@ -1516,17 +1457,6 @@ public interface AvailableSettings {
*/
String HBM2DDL_CREATE_NAMESPACES = "hibernate.hbm2ddl.create_namespaces";
/**
* Specifies whether to automatically create also the database schema/catalog.
* The default is false.
*
* @since 5.0
* @deprecated
*/
@Deprecated
String HBM2DLL_CREATE_NAMESPACES = "hibernate.hbm2dll.create_namespaces";
/**
* @deprecated Use {@link #JAKARTA_HBM2DDL_CREATE_SCHEMAS} instead
*/
@ -1574,7 +1504,7 @@ public interface AvailableSettings {
*
* For Dialect resolution, {@value #JAKARTA_HBM2DDL_DB_NAME} and optionally
* {@value JAKARTA_HBM2DDL_DB_VERSION}, {@value #JAKARTA_HBM2DDL_DB_MAJOR_VERSION}
* and {@value #HBM2DDL_DB_MINOR_VERSION} can be used instead
* and {@value #JAKARTA_HBM2DDL_DB_MINOR_VERSION} can be used instead
*
* @see #JAKARTA_HBM2DDL_DB_NAME
* @see #JAKARTA_HBM2DDL_DB_VERSION
@ -1590,7 +1520,7 @@ public interface AvailableSettings {
*
* For cases when the name of the database vendor is not enough alone, a combination of
* {@value JAKARTA_HBM2DDL_DB_VERSION}, {@value #JAKARTA_HBM2DDL_DB_MAJOR_VERSION}
* {@value #HBM2DDL_DB_MINOR_VERSION} can be used instead
* {@value #JAKARTA_HBM2DDL_DB_MINOR_VERSION} can be used instead
*
* @see #JAKARTA_HBM2DDL_DB_VERSION
* @see #JAKARTA_HBM2DDL_DB_MAJOR_VERSION
@ -1944,12 +1874,6 @@ public interface AvailableSettings {
*/
String EXTRA_PHYSICAL_TABLE_TYPES = "hibernate.hbm2ddl.extra_physical_table_types";
/**
* @deprecated use {@link #EXTRA_PHYSICAL_TABLE_TYPES} instead.
*/
@Deprecated
String DEPRECATED_EXTRA_PHYSICAL_TABLE_TYPES = "hibernate.hbm2dll.extra_physical_table_types";
/**
* Unique columns and unique keys both use unique constraints in most dialects.
* SchemaUpdate needs to create these constraints, but DB's

View File

@ -1811,7 +1811,7 @@ public interface CoreMessageLogger extends BasicLogger {
void unsupportedMappedSuperclassWithEntityInheritance(String entityName);
@LogMessage(level = WARN)
@Message(value = "Multiple configuration properties defined to create schema. Choose at most one among 'javax.persistence.create-database-schemas', 'hibernate.hbm2ddl.create_namespaces', 'hibernate.hbm2dll.create_namespaces' (this last being deprecated).", id = 504)
@Message(value = "Multiple configuration properties defined to create schema. Choose at most one among 'jakarta.persistence.create-database-schemas' or 'hibernate.hbm2ddl.create_namespaces'.", id = 504)
void multipleSchemaCreationSettingsDefined();
@LogMessage(level = WARN)

View File

@ -89,7 +89,6 @@ import jakarta.persistence.PersistenceException;
import jakarta.persistence.spi.PersistenceUnitTransactionType;
import static org.hibernate.cfg.AvailableSettings.ALLOW_REFRESH_DETACHED_ENTITY;
import static org.hibernate.cfg.AvailableSettings.APP_CLASSLOADER;
import static org.hibernate.cfg.AvailableSettings.CFG_XML_FILE;
import static org.hibernate.cfg.AvailableSettings.CLASSLOADERS;
import static org.hibernate.cfg.AvailableSettings.CLASS_CACHE_PREFIX;
@ -464,14 +463,6 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
bsrBuilder.applyClassLoader( providedClassLoader );
}
final ClassLoader appClassLoader = (ClassLoader) integrationSettings.get( APP_CLASSLOADER );
if ( appClassLoader != null ) {
LOG.debugf(
"Found use of deprecated `%s` setting; use `%s` instead.",
APP_CLASSLOADER,
CLASSLOADERS
);
}
final Object classLoadersSetting = integrationSettings.get( CLASSLOADERS );
if ( classLoadersSetting != null ) {
if ( java.util.Collection.class.isInstance( classLoadersSetting ) ) {

View File

@ -137,9 +137,6 @@ public class Helper {
if ( configurationValues.containsKey( AvailableSettings.HBM2DDL_CREATE_NAMESPACES ) ) {
count++;
}
if ( configurationValues.containsKey( AvailableSettings.HBM2DLL_CREATE_NAMESPACES ) ) {
count++;
}
if ( count > 1 ) {
log.multipleSchemaCreationSettingsDefined();
}
@ -155,14 +152,9 @@ public class Helper {
ConfigurationHelper.getBoolean(
AvailableSettings.HBM2DDL_CREATE_NAMESPACES,
configurationValues,
//And finally fall back to the old name this had before we fixed the typo:
ConfigurationHelper.getBoolean(
AvailableSettings.HBM2DLL_CREATE_NAMESPACES,
configurationValues,
false
)
)
)
);
}

View File

@ -51,11 +51,11 @@ import org.hibernate.tool.schema.spi.TargetDescriptor;
import org.jboss.logging.Logger;
import static org.hibernate.cfg.AvailableSettings.DIALECT_DB_MAJOR_VERSION;
import static org.hibernate.cfg.AvailableSettings.DIALECT_DB_MINOR_VERSION;
import static org.hibernate.cfg.AvailableSettings.DIALECT_DB_NAME;
import static org.hibernate.cfg.AvailableSettings.DIALECT_DB_VERSION;
import static org.hibernate.cfg.AvailableSettings.HBM2DDL_CONNECTION;
import static org.hibernate.cfg.AvailableSettings.HBM2DDL_DB_MAJOR_VERSION;
import static org.hibernate.cfg.AvailableSettings.HBM2DDL_DB_MINOR_VERSION;
import static org.hibernate.cfg.AvailableSettings.HBM2DDL_DELIMITER;
import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_DB_MAJOR_VERSION;
import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_DB_MINOR_VERSION;
@ -258,9 +258,9 @@ public class HibernateSchemaManagementTool implements SchemaManagementTool, Serv
final String dbMajor = (String) coalesceSuppliedValues(
() -> configurationValues.get( JAKARTA_HBM2DDL_DB_MAJOR_VERSION ),
() -> {
final String name = (String) configurationValues.get( HBM2DDL_DB_MAJOR_VERSION );
final String name = (String) configurationValues.get( DIALECT_DB_MAJOR_VERSION );
if ( StringHelper.isNotEmpty( name ) ) {
DEPRECATION_LOGGER.deprecatedSetting( HBM2DDL_DB_MAJOR_VERSION, JAKARTA_HBM2DDL_DB_MAJOR_VERSION );
DEPRECATION_LOGGER.deprecatedSetting( DIALECT_DB_MAJOR_VERSION, JAKARTA_HBM2DDL_DB_MAJOR_VERSION );
}
return name;
}
@ -269,9 +269,9 @@ public class HibernateSchemaManagementTool implements SchemaManagementTool, Serv
final String dbMinor = (String) coalesceSuppliedValues(
() -> configurationValues.get( JAKARTA_HBM2DDL_DB_MINOR_VERSION ),
() -> {
final String name = (String) configurationValues.get( HBM2DDL_DB_MINOR_VERSION );
final String name = (String) configurationValues.get( DIALECT_DB_MINOR_VERSION );
if ( StringHelper.isNotEmpty( name ) ) {
DEPRECATION_LOGGER.deprecatedSetting( HBM2DDL_DB_MINOR_VERSION, JAKARTA_HBM2DDL_DB_MINOR_VERSION );
DEPRECATION_LOGGER.deprecatedSetting( DIALECT_DB_MINOR_VERSION, JAKARTA_HBM2DDL_DB_MINOR_VERSION );
}
return name;
}

View File

@ -11,6 +11,7 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
@ -49,7 +50,7 @@ public class ExcludeUnlistedClassesTest extends BaseUnitTestCase {
// see src/test/resources/org/hibernate/jpa/test/persistenceunit/persistence.xml
final Map<String, Object> properties = new HashMap<String, Object>();
properties.put( AvailableSettings.RESOURCES_CLASSLOADER, new TestClassLoader() );
properties.put( AvailableSettings.CLASSLOADERS, Arrays.asList( new TestClassLoader() ) );
final List<ParsedPersistenceXmlDescriptor> parsedDescriptors = PersistenceXmlParser.locatePersistenceUnits(
properties );

View File

@ -94,7 +94,10 @@ List<Object[]> postAndComments = entityManager.createStoredProcedureQuery( "fn_p
* Multi-table bulk manipulation HQL/Criteria query handling
=== Removal
=== Removals
* JMX integration
* JACC integration
* @Deprecated features:
** 'hibernate.classLoader.application', 'hibernate.classLoader.resources', 'hibernate.classLoader.hibernate' and 'hibernate.classLoader.environment': use 'hibernate.classLoaders' instead.
** 'hibernate.hbm2dll.create_namespaces': use 'jakarta.persistence.create-database-schemas' or 'hibernate.hbm2ddl.create_namespaces'