From 986d65a288b29bf49f8b8107d50d11308bb87bbf Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Tue, 28 Sep 2021 19:01:28 -0500 Subject: [PATCH] HHH-14837 - Move to Jakarta EE More settings work --- .../caching/SecondLevelCacheTest.java | 1 - .../userguide/collections/MapKeyTypeTest.java | 2 +- ...ityTypeChangeAuditDefaultTrackingTest.java | 2 +- .../envers/EntityTypeChangeAuditTest.java | 4 +- ...angeAuditTrackingRevisionListenerTest.java | 2 +- .../envers/ValidityStrategyAuditTest.java | 14 +- .../userguide/pc/MultiLoadIdTest.java | 2 - .../internal/AgroalConnectionProvider.java | 3 +- .../boot/internal/MetadataBuilderImpl.java | 4 +- .../hibernate/boot/internal/MetadataImpl.java | 7 +- .../NamedProcedureCallDefinitionImpl.java | 27 +- .../SessionFactoryOptionsBuilder.java | 47 +- ...stractDelegatingSessionFactoryOptions.java | 9 +- .../boot/spi/SessionFactoryOptions.java | 2 - .../org/hibernate/cfg/AvailableSettings.java | 795 ++++++++++-------- .../cfg/annotations/QueryHintDefinition.java | 2 +- .../cfg/beanvalidation/TypeSafeActivator.java | 4 +- .../org/hibernate/ejb/AvailableSettings.java | 14 - .../internal/JdbcEnvironmentInitiator.java | 25 +- .../hibernate/id/enhanced/TableGenerator.java | 11 +- .../internal/FastSessionServices.java | 30 +- .../internal/SessionFactoryImpl.java | 8 +- .../org/hibernate/internal/SessionImpl.java | 45 +- .../org/hibernate/jpa/AvailableSettings.java | 356 -------- .../jpa/HibernateEntityManagerFactory.java | 36 +- .../java/org/hibernate/jpa/QueryHints.java | 20 +- .../EntityManagerFactoryBuilderImpl.java | 166 ++-- .../boot/internal/PersistenceXmlParser.java | 29 +- .../jpa/boot/spi/ProviderChecker.java | 26 +- .../jpa/internal/util/LockOptionsHelper.java | 8 +- .../hibernate/query/spi/AbstractQuery.java | 55 +- .../internal/CdiBeanContainerBuilder.java | 2 +- .../HibernateSchemaManagementTool.java | 4 +- .../cfgxmlpar/META-INF/persistence.xml | 2 +- .../explicitpar/META-INF/persistence.xml | 14 +- .../explicitpar2/META-INF/persistence.xml | 15 +- .../BaseEntityManagerFunctionalTestCase.java | 5 +- .../test/EntityManagerFactoryClosedTest.java | 4 +- .../hibernate/jpa/test/EntityManagerTest.java | 9 +- ...TwoPersistenceUnits2LCDisabledEnabled.java | 2 +- ...ativeQueryResultTypeAutoDiscoveryTest.java | 2 +- .../jpa/PersistenceUnitOverridesTests.java | 29 +- .../scanning/PackagedEntityManagerTest.java | 4 +- .../orm/test/cfg/CfgFilePropertyTest.java | 2 +- ...paOrNativeBootstrapFunctionalTestCase.java | 13 +- .../jpa/cdi/NoCdiAvailableTestDelegate.java | 4 +- .../tck2_2/GeneratedValueTests.java | 4 +- .../ConfigurationObjectSettingTest.java | 14 +- ...eDiscardPersistenceContextOnCloseTest.java | 4 +- ...eDiscardPersistenceContextOnCloseTest.java | 2 +- .../ejb3configuration/InterceptorTest.java | 4 +- .../PersisterClassProviderTest.java | 3 +- .../SessionFactoryObserverTest.java | 14 +- ...entifierGeneratorStrategyProviderTest.java | 13 +- .../orm/test/jpa/emops/FlushModeTest.java | 2 +- .../jakarta/JakartaSchemaToolingTests.java | 18 +- .../hibernate/orm/test/jpa/lock/LockTest.java | 35 +- .../jpa/lock/LockTimeoutPropertyTest.java | 10 +- .../orm/test/jpa/lock/QueryLockingTest.java | 42 +- .../test/jpa/mapping/DefaultCascadeTest.java | 2 +- .../MappedSuperclassWithAttributesTest.java | 2 +- .../MappedSuperclassWithEmbeddedTest.java | 2 +- .../MappedSuperclassWithEmbeddedIdTest.java | 2 +- ...edSuperclassWithEntityWithIdClassTest.java | 2 +- ...SuperclassWithOverriddenAttributeTest.java | 2 +- ...DropUtf8WithoutHbm2DdlCharsetNameTest.java | 3 +- ...hemaDatabaseFileGenerationFailureTest.java | 2 +- ...SchemaScriptFileGenerationFailureTest.java | 2 +- .../SchemaScriptFileGenerationTest.java | 3 +- .../BaseEnversJPAFunctionalTestCase.java | 23 +- .../AbstractEntityManagerTest.java | 2 +- ...tityManagerFactoryBasedFunctionalTest.java | 22 +- release/release.gradle | 1 + 73 files changed, 938 insertions(+), 1164 deletions(-) delete mode 100644 hibernate-core/src/main/java/org/hibernate/ejb/AvailableSettings.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/jpa/AvailableSettings.java diff --git a/documentation/src/test/java/org/hibernate/userguide/caching/SecondLevelCacheTest.java b/documentation/src/test/java/org/hibernate/userguide/caching/SecondLevelCacheTest.java index b76302f6b4..1fc5d1d9e9 100644 --- a/documentation/src/test/java/org/hibernate/userguide/caching/SecondLevelCacheTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/caching/SecondLevelCacheTest.java @@ -56,7 +56,6 @@ public class SecondLevelCacheTest extends BaseEntityManagerFunctionalTestCase { options.put( AvailableSettings.CACHE_REGION_FACTORY, "jcache" ); options.put( AvailableSettings.USE_QUERY_CACHE, Boolean.TRUE.toString() ); options.put( AvailableSettings.GENERATE_STATISTICS, Boolean.TRUE.toString() ); - //options.put( AvailableSettings.CACHE_REGION_PREFIX, "" ); } @Test diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/MapKeyTypeTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/MapKeyTypeTest.java index 312d44ea45..dee9921d8a 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/MapKeyTypeTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/MapKeyTypeTest.java @@ -69,7 +69,7 @@ public class MapKeyTypeTest extends BaseEntityManagerFunctionalTestCase { try { Map settings = buildSettings(); settings.put( - org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, + AvailableSettings.LOADED_CLASSES, Collections.singletonList( Person.class ) diff --git a/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditDefaultTrackingTest.java b/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditDefaultTrackingTest.java index dcd4bfc667..9deb69aa2b 100644 --- a/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditDefaultTrackingTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditDefaultTrackingTest.java @@ -59,7 +59,7 @@ public class EntityTypeChangeAuditDefaultTrackingTest extends BaseEntityManagerF try { Map settings = buildSettings(); settings.put( - org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, + AvailableSettings.LOADED_CLASSES, Arrays.asList( ApplicationCustomer.class, CustomTrackingRevisionEntity.class diff --git a/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditTest.java b/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditTest.java index 0fdac08d41..676da476d9 100644 --- a/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditTest.java @@ -9,7 +9,6 @@ package org.hibernate.userguide.envers; import java.util.Arrays; import java.util.Date; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Set; import jakarta.persistence.Column; @@ -31,7 +30,6 @@ import org.hibernate.envers.Audited; import org.hibernate.envers.DefaultRevisionEntity; import org.hibernate.envers.ModifiedEntityNames; import org.hibernate.envers.RevisionEntity; -import org.hibernate.envers.tools.Pair; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; @@ -83,7 +81,7 @@ public class EntityTypeChangeAuditTest extends BaseEntityManagerFunctionalTestCa try { Map settings = buildSettings(); settings.put( - org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, + AvailableSettings.LOADED_CLASSES, Arrays.asList( ApplicationCustomer.class, CustomTrackingRevisionEntity.class diff --git a/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditTrackingRevisionListenerTest.java b/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditTrackingRevisionListenerTest.java index 01f2df6faf..ab3b78664d 100644 --- a/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditTrackingRevisionListenerTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/envers/EntityTypeChangeAuditTrackingRevisionListenerTest.java @@ -74,7 +74,7 @@ public class EntityTypeChangeAuditTrackingRevisionListenerTest extends BaseEntit try { Map settings = buildSettings(); settings.put( - org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, + AvailableSettings.LOADED_CLASSES, Arrays.asList( ApplicationCustomer.class, CustomTrackingRevisionEntity.class, diff --git a/documentation/src/test/java/org/hibernate/userguide/envers/ValidityStrategyAuditTest.java b/documentation/src/test/java/org/hibernate/userguide/envers/ValidityStrategyAuditTest.java index 5461331fc5..5beb9a4054 100644 --- a/documentation/src/test/java/org/hibernate/userguide/envers/ValidityStrategyAuditTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/envers/ValidityStrategyAuditTest.java @@ -9,23 +9,23 @@ package org.hibernate.userguide.envers; import java.util.Date; import java.util.List; import java.util.Map; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; -import jakarta.persistence.NoResultException; -import jakarta.persistence.Temporal; -import jakarta.persistence.TemporalType; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.envers.AuditReaderFactory; import org.hibernate.envers.Audited; import org.hibernate.envers.configuration.EnversSettings; import org.hibernate.envers.strategy.ValidityAuditStrategy; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.junit.Test; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.NoResultException; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; + import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; diff --git a/documentation/src/test/java/org/hibernate/userguide/pc/MultiLoadIdTest.java b/documentation/src/test/java/org/hibernate/userguide/pc/MultiLoadIdTest.java index 7b737ec1ca..f74fc7acda 100644 --- a/documentation/src/test/java/org/hibernate/userguide/pc/MultiLoadIdTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/pc/MultiLoadIdTest.java @@ -44,8 +44,6 @@ public class MultiLoadIdTest extends BaseEntityManagerFunctionalTestCase { @Override protected void addMappings(Map settings) { -// settings.put( AvailableSettings.USE_SECOND_LEVEL_CACHE, true ); -// settings.put( AvailableSettings.CACHE_REGION_FACTORY, "jcache" ); settings.put( AvailableSettings.GENERATE_STATISTICS, Boolean.TRUE.toString() ); sqlStatementInterceptor = new SQLStatementInterceptor( settings ); } diff --git a/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java b/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java index c53b6c66d3..7723955e1a 100644 --- a/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java +++ b/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java @@ -32,7 +32,6 @@ import java.util.function.Function; /** * ConnectionProvider based on Agroal connection pool * To use this ConnectionProvider set:
 hibernate.connection.provider_class AgroalConnectionProvider 
- * ( @see AvailableSettings#CONNECTION_PROVIDER ) * * Usual hibernate properties are supported: *
@@ -46,6 +45,8 @@ import java.util.function.Function;
  *
  * Other configuration options are available, using the 
hibernate.agroal
prefix ( @see AgroalPropertiesReader ) * + * @see AvailableSettings#CONNECTION_PROVIDER + * * @author Luis Barreiro */ public class AgroalConnectionProvider implements ConnectionProvider, Configurable, Stoppable { diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java index 5e8c746720..bbc244cd93 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java @@ -592,7 +592,7 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont ); this.sharedCacheMode = configService.getSetting( - AvailableSettings.JAKARTA_JPA_SHARED_CACHE_MODE, + AvailableSettings.JAKARTA_SHARED_CACHE_MODE, value -> { if ( value == null ) { return null; @@ -613,7 +613,7 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( AvailableSettings.JPA_SHARED_CACHE_MODE, - AvailableSettings.JAKARTA_JPA_SHARED_CACHE_MODE + AvailableSettings.JAKARTA_SHARED_CACHE_MODE ); if ( value instanceof SharedCacheMode ) { diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java index 7d3a094791..c838f1ad01 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java @@ -38,6 +38,7 @@ import org.hibernate.boot.query.NamedResultSetMappingDescriptor; import org.hibernate.boot.spi.SessionFactoryBuilderFactory; import org.hibernate.boot.spi.SessionFactoryBuilderImplementor; import org.hibernate.boot.spi.SessionFactoryBuilderService; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.annotations.NamedEntityGraphDefinition; import org.hibernate.engine.config.spi.ConfigurationService; import org.hibernate.engine.spi.FilterDefinition; @@ -413,12 +414,10 @@ public class MetadataImpl implements MetadataImplementor, Serializable { continue; } final String propertyName = (String) entry.getKey(); - if ( !propertyName.startsWith( org.hibernate.jpa.AvailableSettings.EVENT_LISTENER_PREFIX ) ) { + if ( ! propertyName.startsWith( AvailableSettings.EVENT_LISTENER_PREFIX ) ) { continue; } - final String eventTypeName = propertyName.substring( - org.hibernate.jpa.AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 - ); + final String eventTypeName = propertyName.substring( AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 ); final EventType eventType = EventType.resolveEventTypeByName( eventTypeName ); final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType ); for ( String listenerImpl : LISTENER_SEPARATION_PATTERN.split( ( (String) entry.getValue() ) ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/NamedProcedureCallDefinitionImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/NamedProcedureCallDefinitionImpl.java index 5b644c93df..82fff0f902 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/NamedProcedureCallDefinitionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/NamedProcedureCallDefinitionImpl.java @@ -11,15 +11,11 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import jakarta.persistence.NamedStoredProcedureQuery; -import jakarta.persistence.ParameterMode; -import jakarta.persistence.StoredProcedureParameter; import org.hibernate.CacheMode; import org.hibernate.FlushMode; import org.hibernate.MappingException; import org.hibernate.boot.query.NamedProcedureCallDefinition; -import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.annotations.QueryHintDefinition; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.internal.util.StringHelper; @@ -30,6 +26,10 @@ import org.hibernate.procedure.spi.ParameterStrategy; import org.hibernate.query.internal.ResultSetMappingResolutionContext; import org.hibernate.query.results.ResultSetMappingImpl; +import jakarta.persistence.NamedStoredProcedureQuery; +import jakarta.persistence.ParameterMode; +import jakarta.persistence.StoredProcedureParameter; + import static org.hibernate.procedure.spi.NamedCallableQueryMemento.ParameterMemento; /** @@ -206,27 +206,13 @@ public class NamedProcedureCallDefinitionImpl implements NamedProcedureCallDefin private final String name; private final ParameterMode parameterMode; private final Class type; - private final Boolean explicitPassNullSetting; static ParameterDefinition from( ParameterStrategy parameterStrategy, StoredProcedureParameter parameterAnnotation, int adjustedPosition, Map queryHintMap) { - // see if there was an explicit hint for this parameter in regards to NULL passing - final Object explicitNullPassingHint; - if ( parameterStrategy == ParameterStrategy.NAMED ) { - explicitNullPassingHint = queryHintMap.get( AvailableSettings.PROCEDURE_NULL_PARAM_PASSING + '.' + parameterAnnotation.name() ); - } - else { - explicitNullPassingHint = queryHintMap.get( AvailableSettings.PROCEDURE_NULL_PARAM_PASSING + '.' + adjustedPosition ); - } - - return new ParameterDefinition( - adjustedPosition, - parameterAnnotation, - interpretBoolean( explicitNullPassingHint ) - ); + return new ParameterDefinition( adjustedPosition, parameterAnnotation ); } private static Boolean interpretBoolean(Object value) { @@ -241,12 +227,11 @@ public class NamedProcedureCallDefinitionImpl implements NamedProcedureCallDefin return Boolean.valueOf( value.toString() ); } - ParameterDefinition(int position, StoredProcedureParameter annotation, Boolean explicitPassNullSetting) { + ParameterDefinition(int position, StoredProcedureParameter annotation) { this.position = position; this.name = normalize( annotation.name() ); this.parameterMode = annotation.mode(); this.type = annotation.type(); - this.explicitPassNullSetting = explicitPassNullSetting; } @SuppressWarnings("UnnecessaryUnboxing") diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java index 142d7b3ec9..747a01906c 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java @@ -25,7 +25,6 @@ import org.hibernate.EntityNameResolver; import org.hibernate.HibernateException; import org.hibernate.Interceptor; import org.hibernate.MultiTenancyStrategy; -import org.hibernate.query.NullPrecedence; import org.hibernate.SessionEventListener; import org.hibernate.SessionFactoryObserver; import org.hibernate.boot.SchemaAutoTooling; @@ -49,6 +48,7 @@ import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.id.uuid.LocalObjectUuidHelper; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.log.DeprecationLogger; +import org.hibernate.internal.util.NullnessHelper; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.jpa.spi.JpaCompliance; @@ -56,6 +56,7 @@ import org.hibernate.jpa.spi.MutableJpaCompliance; import org.hibernate.loader.BatchFetchStyle; import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode; +import org.hibernate.query.NullPrecedence; import org.hibernate.query.criteria.ValueHandlingMode; import org.hibernate.query.hql.HqlTranslator; import org.hibernate.query.sqm.function.SqmFunctionDescriptor; @@ -89,6 +90,7 @@ import static org.hibernate.cfg.AvailableSettings.CUSTOM_ENTITY_DIRTINESS_STRATE import static org.hibernate.cfg.AvailableSettings.DEFAULT_BATCH_FETCH_SIZE; import static org.hibernate.cfg.AvailableSettings.DEFAULT_ENTITY_MODE; import static org.hibernate.cfg.AvailableSettings.DELAY_ENTITY_LOADER_CREATIONS; +import static org.hibernate.cfg.AvailableSettings.DISCARD_PC_ON_CLOSE; import static org.hibernate.cfg.AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS; import static org.hibernate.cfg.AvailableSettings.FAIL_ON_PAGINATION_OVER_COLLECTION_FETCH; import static org.hibernate.cfg.AvailableSettings.FLUSH_BEFORE_COMPLETION; @@ -107,7 +109,6 @@ import static org.hibernate.cfg.AvailableSettings.OMIT_JOIN_OF_SUPERCLASS_TABLES import static org.hibernate.cfg.AvailableSettings.ORDER_INSERTS; import static org.hibernate.cfg.AvailableSettings.ORDER_UPDATES; import static org.hibernate.cfg.AvailableSettings.PREFER_USER_TRANSACTION; -import static org.hibernate.cfg.AvailableSettings.PROCEDURE_NULL_PARAM_PASSING; import static org.hibernate.cfg.AvailableSettings.QUERY_CACHE_FACTORY; import static org.hibernate.cfg.AvailableSettings.QUERY_STARTUP_CHECKING; import static org.hibernate.cfg.AvailableSettings.QUERY_STATISTICS_MAX_SIZE; @@ -132,7 +133,6 @@ import static org.hibernate.cfg.AvailableSettings.VALIDATE_QUERY_PARAMETERS; import static org.hibernate.cfg.AvailableSettings.WRAP_RESULT_SETS; import static org.hibernate.engine.config.spi.StandardConverters.BOOLEAN; import static org.hibernate.internal.CoreLogging.messageLogger; -import static org.hibernate.jpa.AvailableSettings.DISCARD_PC_ON_CLOSE; /** * In-flight state of {@link SessionFactoryOptions} @@ -217,7 +217,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { private Map querySubstitutions; private boolean namedQueryStartupCheckingEnabled; private boolean conventionalJavaConstants; - private final boolean procedureParameterNullPassingEnabled; private final boolean omitJoinOfSuperclassTablesEnabled; private final int preferredSqlTypeCodeForBoolean; @@ -279,13 +278,23 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { ( (ConfigurationServiceImpl) cfgService ).injectServices( (ServiceRegistryImplementor) serviceRegistry ); } - this.beanManagerReference = configurationSettings.getOrDefault( - AvailableSettings.CDI_BEAN_MANAGER, - configurationSettings.get( AvailableSettings.JAKARTA_CDI_BEAN_MANAGER ) + this.beanManagerReference = NullnessHelper.coalesceSuppliedValues( + () -> configurationSettings.get( AvailableSettings.JAKARTA_CDI_BEAN_MANAGER ), + () -> { + final Object value = configurationSettings.get( AvailableSettings.CDI_BEAN_MANAGER ); + if ( value != null ) { + DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( + AvailableSettings.CDI_BEAN_MANAGER, + AvailableSettings.JAKARTA_CDI_BEAN_MANAGER + ); + } + return value; + } ); + this.validatorFactoryReference = configurationSettings.getOrDefault( AvailableSettings.JPA_VALIDATION_FACTORY, - configurationSettings.get( AvailableSettings.JAKARTA_JPA_VALIDATION_FACTORY ) + configurationSettings.get( AvailableSettings.JAKARTA_VALIDATION_FACTORY ) ); this.sessionFactoryName = (String) configurationSettings.get( SESSION_FACTORY_NAME ); @@ -411,7 +420,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { this.namedQueryStartupCheckingEnabled = cfgService.getSetting( QUERY_STARTUP_CHECKING, BOOLEAN, true ); this.conventionalJavaConstants = cfgService.getSetting( CONVENTIONAL_JAVA_CONSTANTS, BOOLEAN, true ); - this.procedureParameterNullPassingEnabled = cfgService.getSetting( PROCEDURE_NULL_PARAM_PASSING, BOOLEAN, false ); this.omitJoinOfSuperclassTablesEnabled = cfgService.getSetting( OMIT_JOIN_OF_SUPERCLASS_TABLES, BOOLEAN, true ); this.preferredSqlTypeCodeForBoolean = ConfigurationHelper.getPreferredSqlTypeCodeForBoolean( serviceRegistry ); @@ -644,10 +652,10 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { Object setting = configurationSettings.get( INTERCEPTOR ); if ( setting == null ) { // try the legacy (deprecated) JPA name - setting = configurationSettings.get( org.hibernate.jpa.AvailableSettings.INTERCEPTOR ); + setting = configurationSettings.get( org.hibernate.cfg.AvailableSettings.INTERCEPTOR ); if ( setting != null ) { DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( - org.hibernate.jpa.AvailableSettings.INTERCEPTOR, + org.hibernate.cfg.AvailableSettings.INTERCEPTOR, INTERCEPTOR ); } @@ -659,21 +667,11 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { ); } - @SuppressWarnings({"unchecked", "deprecation"}) + @SuppressWarnings({"unchecked" }) private static Supplier determineStatelessInterceptor( Map configurationSettings, StrategySelector strategySelector) { Object setting = configurationSettings.get( SESSION_SCOPED_INTERCEPTOR ); - if ( setting == null ) { - // try the legacy (deprecated) JPA name - setting = configurationSettings.get( org.hibernate.jpa.AvailableSettings.SESSION_INTERCEPTOR ); - if ( setting != null ) { - DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( - org.hibernate.jpa.AvailableSettings.SESSION_INTERCEPTOR, - SESSION_SCOPED_INTERCEPTOR - ); - } - } if ( setting == null ) { return null; @@ -995,11 +993,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { return conventionalJavaConstants; } - @Override - public boolean isProcedureParameterNullPassingEnabled() { - return procedureParameterNullPassingEnabled; - } - @Override public boolean isSecondLevelCacheEnabled() { return secondLevelCacheEnabled; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryOptions.java index d38ea119dc..8533f25b79 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryOptions.java @@ -16,7 +16,6 @@ import org.hibernate.EntityMode; import org.hibernate.EntityNameResolver; import org.hibernate.Interceptor; import org.hibernate.MultiTenancyStrategy; -import org.hibernate.query.NullPrecedence; import org.hibernate.SessionFactoryObserver; import org.hibernate.boot.SchemaAutoTooling; import org.hibernate.boot.TempTableDdlTransactionHandling; @@ -28,11 +27,12 @@ import org.hibernate.jpa.spi.JpaCompliance; import org.hibernate.loader.BatchFetchStyle; import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode; +import org.hibernate.query.NullPrecedence; import org.hibernate.query.criteria.ValueHandlingMode; import org.hibernate.query.hql.HqlTranslator; import org.hibernate.query.sqm.function.SqmFunctionDescriptor; -import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy; import org.hibernate.query.sqm.function.SqmFunctionRegistry; +import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy; import org.hibernate.query.sqm.sql.SqmTranslatorFactory; import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.resource.jdbc.spi.StatementInspector; @@ -238,11 +238,6 @@ public class AbstractDelegatingSessionFactoryOptions implements SessionFactoryOp return delegate.isConventionalJavaConstants(); } - @Override - public boolean isProcedureParameterNullPassingEnabled() { - return delegate.isProcedureParameterNullPassingEnabled(); - } - @Override public boolean isAllowOutOfTransactionUpdateOperations() { return delegate.isAllowOutOfTransactionUpdateOperations(); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java index 553af0e1d4..d7ad0962a6 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java @@ -259,8 +259,6 @@ public interface SessionFactoryOptions extends QueryEngineOptions { boolean isPreferUserTransaction(); - boolean isProcedureParameterNullPassingEnabled(); - boolean isAllowOutOfTransactionUpdateOperations(); boolean isReleaseResourcesOnCloseEnabled(); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index 0a4199d135..c9d492f879 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -7,7 +7,6 @@ package org.hibernate.cfg; import java.util.function.Supplier; -import jakarta.persistence.GeneratedValue; import org.hibernate.HibernateException; import org.hibernate.Transaction; @@ -32,10 +31,10 @@ import org.hibernate.tool.schema.SourceType; /** * @author Steve Ebersole */ -public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { +public interface AvailableSettings { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // JPA defined settings + // Jakarta Persistence defined settings // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -43,28 +42,28 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { *

* See JPA 2 sections 9.4.3 and 8.2.1.4 */ - String JPA_PERSISTENCE_PROVIDER = "javax.persistence.provider"; + String JAKARTA_PERSISTENCE_PROVIDER = "jakarta.persistence.provider"; /** * The type of transactions supported by the entity managers. *

* See JPA 2 sections 9.4.3 and 8.2.1.2 */ - String JPA_TRANSACTION_TYPE = "javax.persistence.transactionType"; + String JAKARTA_TRANSACTION_TYPE = "jakarta.persistence.transactionType"; /** * The JNDI name of a JTA {@link javax.sql.DataSource}. *

* See JPA 2 sections 9.4.3 and 8.2.1.5 */ - String JPA_JTA_DATASOURCE = "javax.persistence.jtaDataSource"; + String JAKARTA_JTA_DATASOURCE = "jakarta.persistence.jtaDataSource"; /** * The JNDI name of a non-JTA {@link javax.sql.DataSource}. *

* See JPA 2 sections 9.4.3 and 8.2.1.5 */ - String JPA_NON_JTA_DATASOURCE = "javax.persistence.nonJtaDataSource"; + String JAKARTA_NON_JTA_DATASOURCE = "jakarta.persistence.nonJtaDataSource"; /** * The name of a JDBC driver to use to connect to the database. @@ -75,7 +74,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { *

* See section 8.2.1.9 */ - String JPA_JDBC_DRIVER = "javax.persistence.jdbc.driver"; + String JAKARTA_JDBC_DRIVER = "jakarta.persistence.jdbc.driver"; /** * The JDBC connection url to use to connect to the database. @@ -86,7 +85,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { *

* See section 8.2.1.9 */ - String JPA_JDBC_URL = "javax.persistence.jdbc.url"; + String JAKARTA_JDBC_URL = "jakarta.persistence.jdbc.url"; /** * The JDBC connection user name. @@ -97,7 +96,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { *

* See section 8.2.1.9 */ - String JPA_JDBC_USER = "javax.persistence.jdbc.user"; + String JAKARTA_JDBC_USER = "jakarta.persistence.jdbc.user"; /** * The JDBC connection password. @@ -108,16 +107,17 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { *

* See JPA 2 section 8.2.1.9 */ - String JPA_JDBC_PASSWORD = "javax.persistence.jdbc.password"; + String JAKARTA_JDBC_PASSWORD = "jakarta.persistence.jdbc.password"; /** * Used to indicate whether second-level (what JPA terms shared cache) caching is * enabled as per the rules defined in JPA 2 section 3.1.7. *

* See JPA 2 sections 9.4.3 and 8.2.1.7 + * * @see jakarta.persistence.SharedCacheMode */ - String JPA_SHARED_CACHE_MODE = "javax.persistence.sharedCache.mode"; + String JAKARTA_SHARED_CACHE_MODE = "jakarta.persistence.sharedCache.mode"; /** * NOTE : Not a valid EMF property... @@ -127,7 +127,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * * @see jakarta.persistence.CacheRetrieveMode */ - String JPA_SHARED_CACHE_RETRIEVE_MODE ="jakarta.persistence.cache.retrieveMode"; + String JAKARTA_SHARED_CACHE_RETRIEVE_MODE ="jakarta.persistence.cache.retrieveMode"; /** * NOTE : Not a valid EMF property... @@ -137,7 +137,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * * @see jakarta.persistence.CacheStoreMode */ - String JPA_SHARED_CACHE_STORE_MODE ="jakarta.persistence.cache.storeMode"; + String JAKARTA_SHARED_CACHE_STORE_MODE ="jakarta.persistence.cache.storeMode"; /** * Used to indicate what form of automatic validation is in effect as per rules defined @@ -146,226 +146,47 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * See JPA 2 sections 9.4.3 and 8.2.1.8 * @see jakarta.persistence.ValidationMode */ - String JPA_VALIDATION_MODE = "javax.persistence.validation.mode"; + String JAKARTA_VALIDATION_MODE = "jakarta.persistence.validation.mode"; /** * Used to pass along any discovered validator factory. */ - String JPA_VALIDATION_FACTORY = "javax.persistence.validation.factory"; + String JAKARTA_VALIDATION_FACTORY = "jakarta.persistence.validation.factory"; /** * Used to coordinate with bean validators *

* See JPA 2 section 8.2.1.9 */ - String JPA_PERSIST_VALIDATION_GROUP = "javax.persistence.validation.group.pre-persist"; + String JAKARTA_PERSIST_VALIDATION_GROUP = "jakarta.persistence.validation.group.pre-persist"; /** * Used to coordinate with bean validators *

* See JPA 2 section 8.2.1.9 */ - String JPA_UPDATE_VALIDATION_GROUP = "javax.persistence.validation.group.pre-update"; + String JAKARTA_UPDATE_VALIDATION_GROUP = "jakarta.persistence.validation.group.pre-update"; /** * Used to coordinate with bean validators *

* See JPA 2 section 8.2.1.9 */ - String JPA_REMOVE_VALIDATION_GROUP = "javax.persistence.validation.group.pre-remove"; + String JAKARTA_REMOVE_VALIDATION_GROUP = "jakarta.persistence.validation.group.pre-remove"; /** * Used to request (hint) a pessimistic lock scope. *

* See JPA 2 sections 8.2.1.9 and 3.4.4.3 */ - String JPA_LOCK_SCOPE = "javax.persistence.lock.scope"; + String JAKARTA_LOCK_SCOPE = "jakarta.persistence.lock.scope"; /** * Used to request (hint) a pessimistic lock timeout (in milliseconds). *

* See JPA 2 sections 8.2.1.9 and 3.4.4.3 */ - String JPA_LOCK_TIMEOUT = "javax.persistence.lock.timeout"; - - /** - * Used to pass along the CDI BeanManager, if any, to be used. - * - * According to JPA, strictly, the BeanManager should be passed in - * at boot-time and be ready for use at that time. However not all - * environments can do this (WildFly e.g.). To accommodate such - * environments, Hibernate provides 2 options: - * - * * a proprietary CDI extension SPI (that we have proposed to - * the CDI spec group as a standard option) that can be used - * to provide delayed BeanManager access. To use this solution, - * the reference passed as the BeanManager during bootstrap - * should be typed as {@link ExtendedBeanManager} - * * delayed access to the BeanManager reference. Here, Hibernate - * will not access the reference passed as the BeanManager during - * bootstrap until it is first needed. Note however that this has - * the effect of delaying any deployment problems until after - * bootstrapping. - * - * This setting is used to configure Hibernate ORM's access to - * the BeanManager (either directly or via {@link ExtendedBeanManager}). - */ - String CDI_BEAN_MANAGER = "jakarta.persistence.bean.manager"; - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Jakarta JPA defined settings - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - /** - * The name of the {@link jakarta.persistence.spi.PersistenceProvider} implementor - *

- * See JPA 2 sections 9.4.3 and 8.2.1.4 - */ - String JAKARTA_JPA_PERSISTENCE_PROVIDER = "jakarta.persistence.provider"; - - /** - * The type of transactions supported by the entity managers. - *

- * See JPA 2 sections 9.4.3 and 8.2.1.2 - */ - String JAKARTA_JPA_TRANSACTION_TYPE = "jakarta.persistence.transactionType"; - - /** - * The JNDI name of a JTA {@link javax.sql.DataSource}. - *

- * See JPA 2 sections 9.4.3 and 8.2.1.5 - */ - String JAKARTA_JPA_JTA_DATASOURCE = "jakarta.persistence.jtaDataSource"; - - /** - * The JNDI name of a non-JTA {@link javax.sql.DataSource}. - *

- * See JPA 2 sections 9.4.3 and 8.2.1.5 - */ - String JAKARTA_JPA_NON_JTA_DATASOURCE = "jakarta.persistence.nonJtaDataSource"; - - /** - * The name of a JDBC driver to use to connect to the database. - *

- * Used in conjunction with {@link #JPA_JDBC_URL}, {@link #JPA_JDBC_USER} and {@link #JPA_JDBC_PASSWORD} - * to define how to make connections to the database in lieu of - * a datasource (either {@link #JPA_JTA_DATASOURCE} or {@link #JPA_NON_JTA_DATASOURCE}). - *

- * See section 8.2.1.9 - */ - String JAKARTA_JPA_JDBC_DRIVER = "jakarta.persistence.jdbc.driver"; - - /** - * The JDBC connection url to use to connect to the database. - *

- * Used in conjunction with {@link #JPA_JDBC_DRIVER}, {@link #JPA_JDBC_USER} and {@link #JPA_JDBC_PASSWORD} - * to define how to make connections to the database in lieu of - * a datasource (either {@link #JPA_JTA_DATASOURCE} or {@link #JPA_NON_JTA_DATASOURCE}). - *

- * See section 8.2.1.9 - */ - String JAKARTA_JPA_JDBC_URL = "jakarta.persistence.jdbc.url"; - - /** - * The JDBC connection user name. - *

- * Used in conjunction with {@link #JPA_JDBC_DRIVER}, {@link #JPA_JDBC_URL} and {@link #JPA_JDBC_PASSWORD} - * to define how to make connections to the database in lieu of - * a datasource (either {@link #JPA_JTA_DATASOURCE} or {@link #JPA_NON_JTA_DATASOURCE}). - *

- * See section 8.2.1.9 - */ - String JAKARTA_JPA_JDBC_USER = "jakarta.persistence.jdbc.user"; - - /** - * The JDBC connection password. - *

- * Used in conjunction with {@link #JPA_JDBC_DRIVER}, {@link #JPA_JDBC_URL} and {@link #JPA_JDBC_USER} - * to define how to make connections to the database in lieu of - * a datasource (either {@link #JPA_JTA_DATASOURCE} or {@link #JPA_NON_JTA_DATASOURCE}). - *

- * See JPA 2 section 8.2.1.9 - */ - String JAKARTA_JPA_JDBC_PASSWORD = "jakarta.persistence.jdbc.password"; - - /** - * Used to indicate whether second-level (what JPA terms shared cache) caching is - * enabled as per the rules defined in JPA 2 section 3.1.7. - *

- * See JPA 2 sections 9.4.3 and 8.2.1.7 - * @see jakarta.persistence.SharedCacheMode - */ - String JAKARTA_JPA_SHARED_CACHE_MODE = "jakarta.persistence.sharedCache.mode"; - - /** - * NOTE : Not a valid EMF property... - *

- * Used to indicate if the provider should attempt to retrieve requested data - * in the shared cache. - * - * @see jakarta.persistence.CacheRetrieveMode - */ - String JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE ="jakarta.persistence.cache.retrieveMode"; - - /** - * NOTE : Not a valid EMF property... - *

- * Used to indicate if the provider should attempt to store data loaded from the database - * in the shared cache. - * - * @see jakarta.persistence.CacheStoreMode - */ - String JAKARTA_JPA_SHARED_CACHE_STORE_MODE ="jakarta.persistence.cache.storeMode"; - - /** - * Used to indicate what form of automatic validation is in effect as per rules defined - * in JPA 2 section 3.6.1.1 - *

- * See JPA 2 sections 9.4.3 and 8.2.1.8 - * @see jakarta.persistence.ValidationMode - */ - String JAKARTA_JPA_VALIDATION_MODE = "jakarta.persistence.validation.mode"; - - /** - * Used to pass along any discovered validator factory. - */ - String JAKARTA_JPA_VALIDATION_FACTORY = "jakarta.persistence.validation.factory"; - - /** - * Used to coordinate with bean validators - *

- * See JPA 2 section 8.2.1.9 - */ - String JAKARTA_JPA_PERSIST_VALIDATION_GROUP = "jakarta.persistence.validation.group.pre-persist"; - - /** - * Used to coordinate with bean validators - *

- * See JPA 2 section 8.2.1.9 - */ - String JAKARTA_JPA_UPDATE_VALIDATION_GROUP = "jakarta.persistence.validation.group.pre-update"; - - /** - * Used to coordinate with bean validators - *

- * See JPA 2 section 8.2.1.9 - */ - String JAKARTA_JPA_REMOVE_VALIDATION_GROUP = "jakarta.persistence.validation.group.pre-remove"; - - /** - * Used to request (hint) a pessimistic lock scope. - *

- * See JPA 2 sections 8.2.1.9 and 3.4.4.3 - */ - String JAKARTA_JPA_LOCK_SCOPE = "jakarta.persistence.lock.scope"; - - /** - * Used to request (hint) a pessimistic lock timeout (in milliseconds). - *

- * See JPA 2 sections 8.2.1.9 and 3.4.4.3 - */ - String JAKARTA_JPA_LOCK_TIMEOUT = "jakarta.persistence.lock.timeout"; + String JAKARTA_LOCK_TIMEOUT = "jakarta.persistence.lock.timeout"; /** * Used to pass along the CDI BeanManager, if any, to be used. @@ -621,7 +442,10 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * @see #DIALECT_DB_VERSION * @see #DIALECT_DB_MAJOR_VERSION * @see #DIALECT_DB_MINOR_VERSION + * + * @deprecated Use {@link #JAKARTA_HBM2DDL_DB_VERSION} instead */ + @Deprecated String DIALECT_DB_NAME = "javax.persistence.database-product-name"; /** @@ -1301,6 +1125,27 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { */ String BEAN_CONTAINER = "hibernate.resource.beans.container"; + /** + * Used in conjunction with {@value #BEAN_CONTAINER} where CDI is being used. + * + * By default, to be JPA spec compliant, Hibernate should access the CDI + * {@link jakarta.enterprise.inject.spi.BeanManager} while bootstrapping the + * SessionFactory. In some cases however this can lead to a chicken-egg + * situation where JPA provider immediately accessed the BeanManager where + * managed-beans are waiting for JPA PU injection. + * + * This setting tells Hibernate to delay accessing until first use. + * + * This setting has the decided downside that bean config problems will not be + * done at deployment time, but will instead manifest at runtime. For this reason, + * the preferred means for supplying a CDI BeanManager is to provide an implementation + * of {@link ExtendedBeanManager} which gives Hibernate a callback when the BeanManager + * is ready for use. + * + * @since 5.0.8 + */ + String DELAY_CDI_ACCESS = "hibernate.delay_cdi_access"; + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1565,34 +1410,21 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { String HBM2DDL_AUTO = "hibernate.hbm2ddl.auto"; /** - * Setting to perform SchemaManagementTool actions against the database directly via JDBC - * automatically as part of the SessionFactory lifecycle. Valid options are defined by the - * {@link org.hibernate.tool.schema.Action} enum. - *

- * Interpreted in combination with {@link #HBM2DDL_AUTO}. If no value is specified, the default - * is "none" ({@link org.hibernate.tool.schema.Action#NONE}). - * - * @see org.hibernate.tool.schema.Action + * @deprecated Use {@link #JAKARTA_HBM2DDL_SCRIPTS_ACTION} instead */ + @Deprecated String HBM2DDL_DATABASE_ACTION = "javax.persistence.schema-generation.database.action"; /** - * Setting to perform SchemaManagementTool actions writing the commands into a DDL script file. - * Valid options are defined by the {@link org.hibernate.tool.schema.Action} enum. - *

- * Interpreted in combination with {@link #HBM2DDL_AUTO}. If no value is specified, the default - * is "none" ({@link org.hibernate.tool.schema.Action#NONE}). - * - * @see org.hibernate.tool.schema.Action + * @deprecated Use {@link #JAKARTA_HBM2DDL_SCRIPTS_ACTION} instead */ + @Deprecated String HBM2DDL_SCRIPTS_ACTION = "javax.persistence.schema-generation.scripts.action"; /** - * Allows passing a specific {@link java.sql.Connection} instance to be used by SchemaManagementTool. - *

- * May also be used to determine the values for {@value #DIALECT_DB_NAME}, - * {@value #DIALECT_DB_MAJOR_VERSION} and {@value #DIALECT_DB_MINOR_VERSION}. + * @deprecated Use {@link #JAKARTA_HBM2DDL_CONNECTION} instead */ + @Deprecated String HBM2DDL_CONNECTION = "javax.persistence.schema-generation-connection"; /** @@ -1720,13 +1552,9 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { String HBM2DDL_IMPORT_FILES = "hibernate.hbm2ddl.import_files"; /** - * JPA variant of {@link #HBM2DDL_IMPORT_FILES} - *

- * Specifies a {@link java.io.Reader} configured for reading of the SQL load script or a string designating the - * file {@link java.net.URL} for the SQL load script. - *

- * A "SQL load script" is a script that performs some database initialization (INSERT, etc). + * @deprecated Use {@link #JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE} instead */ + @Deprecated String HBM2DDL_LOAD_SCRIPT_SOURCE = "javax.persistence.sql-load-script-source"; /** @@ -1762,97 +1590,115 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { String HBM2DLL_CREATE_NAMESPACES = "hibernate.hbm2dll.create_namespaces"; /** - * The JPA variant of {@link #HBM2DDL_CREATE_NAMESPACES} - *

- * Specifies whether the persistence provider is to create the database schema(s) in addition to creating - * database objects (tables, sequences, constraints, etc). The value of this boolean property should be set - * to {@code true} if the persistence provider is to create schemas in the database or to generate DDL that - * contains "CREATE SCHEMA" commands. If this property is not supplied (or is explicitly {@code false}), the - * provider should not attempt to create database schemas. + * @deprecated Use {@link #JAKARTA_HBM2DDL_CREATE_SCHEMAS} instead */ + @Deprecated String HBM2DDL_CREATE_SCHEMAS = "javax.persistence.create-database-schemas"; /** - * Setting to perform SchemaManagementTool actions against the database directly via JDBC - * automatically as part of the SessionFactory lifecycle. Valid options are defined by the - * {@link org.hibernate.tool.schema.Action} enum. - *

- * Interpreted in combination with {@link #HBM2DDL_AUTO}. If no value is specified, the default - * is "none" ({@link org.hibernate.tool.schema.Action#NONE}). + * Specifies what type (including none) of schema-tooling should be performed against + * the database specified using either {@value #JAKARTA_HBM2DDL_CONNECTION} or + * the configured {@link org.hibernate.engine.jdbc.connections.spi.ConnectionProvider} + * for the SessionFactory. + * + * Valid options are defined by the {@link org.hibernate.tool.schema.Action} enum. + * + * Works in conjunction with {@value #HBM2DDL_AUTO}, with {@value #JAKARTA_HBM2DDL_DATABASE_ACTION} + * having precedence. + * + * If no value is specified, the default is "none" ({@link org.hibernate.tool.schema.Action#NONE}). * * @see org.hibernate.tool.schema.Action + * @see #JAKARTA_HBM2DDL_CONNECTION + * @see #JAKARTA_JDBC_URL */ String JAKARTA_HBM2DDL_DATABASE_ACTION = "jakarta.persistence.schema-generation.database.action"; /** - * Setting to perform SchemaManagementTool actions writing the commands into a DDL script file. + * Specifies what type (including none) of schema-tooling should be written to script files. + * * Valid options are defined by the {@link org.hibernate.tool.schema.Action} enum. - *

- * Interpreted in combination with {@link #HBM2DDL_AUTO}. If no value is specified, the default - * is "none" ({@link org.hibernate.tool.schema.Action#NONE}). + * + * The script file is identified using {@value #JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET} + * + * If no value is specified, the default is "none" ({@link org.hibernate.tool.schema.Action#NONE}). * * @see org.hibernate.tool.schema.Action + * @see #JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET + * @see #JAKARTA_HBM2DDL_SCRIPTS_DROP_TARGET */ String JAKARTA_HBM2DDL_SCRIPTS_ACTION = "jakarta.persistence.schema-generation.scripts.action"; /** - * Allows passing a specific {@link java.sql.Connection} instance to be used by SchemaManagementTool. - *

- * May also be used to determine the values for {@value #HBM2DDL_DB_NAME}, - * {@value #HBM2DDL_DB_MAJOR_VERSION} and {@value #HBM2DDL_DB_MINOR_VERSION}. + * Allows passing a specific {@link java.sql.Connection} instance to be used by + * SchemaManagementTool for the purpose of Dialect determination as well as + * {@value #JAKARTA_HBM2DDL_DATABASE_ACTION database actions} if requested. + * + * 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 + * + * @see #JAKARTA_HBM2DDL_DB_NAME + * @see #JAKARTA_HBM2DDL_DB_VERSION + * @see #JAKARTA_HBM2DDL_DB_MAJOR_VERSION + * @see #JAKARTA_HBM2DDL_DB_MINOR_VERSION */ String JAKARTA_HBM2DDL_CONNECTION = "jakarta.persistence.schema-generation-connection"; /** - * Specifies the name of the database provider in cases where a Connection to the underlying database is - * not available (aka, mainly in generating scripts). In such cases, a value for this setting - * *must* be specified. - *

- * The value of this setting is expected to match the value returned by - * {@link java.sql.DatabaseMetaData#getDatabaseProductName()} for the target database. - *

- * Additionally specifying {@value #HBM2DDL_DB_MAJOR_VERSION} and/or {@value #HBM2DDL_DB_MINOR_VERSION} - * may be required to understand exactly how to generate the required schema commands. + * Specifies the name of the database vendor (as would be reported by + * {@link java.sql.DatabaseMetaData#getDatabaseProductName}) for the + * purpose of determining the Dialect to use. * - * @see #HBM2DDL_DB_MAJOR_VERSION - * @see #HBM2DDL_DB_MINOR_VERSION + * 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 + * + * @see #JAKARTA_HBM2DDL_DB_VERSION + * @see #JAKARTA_HBM2DDL_DB_MAJOR_VERSION + * @see #JAKARTA_HBM2DDL_DB_MINOR_VERSION + * + * @implSpec {@value #JAKARTA_HBM2DDL_DATABASE_ACTION database actions} are not + * available when supplying just the name and versions */ - @SuppressWarnings("JavaDoc") String JAKARTA_HBM2DDL_DB_NAME = "jakarta.persistence.database-product-name"; /** - * Specifies the name of the database provider in cases where a Connection to the underlying database is - * not available (aka, mainly in generating scripts). This value is used to help more precisely determine - * how to perform schema generation tasks for the underlying database in cases where - * {@value #DIALECT_DB_NAME} does not provide enough distinction. - *

- * The value of this setting is expected to match the value returned by - * {@link java.sql.DatabaseMetaData#getDatabaseProductVersion()} for the target database. + * Used in conjunction with {@value #JAKARTA_HBM2DDL_DB_NAME} for the + * purpose of determining the Dialect to use when the name does not + * provide enough detail. * - * @see #DIALECT_DB_NAME + * The value is expected to match what would be returned from + * {@link java.sql.DatabaseMetaData#getDatabaseProductVersion()}) for + * the underlying database. + * + * @see #JAKARTA_HBM2DDL_DB_NAME */ String JAKARTA_HBM2DDL_DB_VERSION = "jakarta.persistence.database-product-version"; /** - * Specifies the major version of the underlying database, as would be returned by - * {@link java.sql.DatabaseMetaData#getDatabaseMajorVersion} for the target database. This value is used to - * help more precisely determine how to perform schema generation tasks for the underlying database in cases - * where {@value #HBM2DDL_DB_NAME} does not provide enough distinction. - - * @see #HBM2DDL_DB_NAME - * @see #HBM2DDL_DB_MINOR_VERSION + * Used in conjunction with {@value #JAKARTA_HBM2DDL_DB_NAME} for the + * purpose of determining the Dialect to use when the name does not + * provide enough detail. + * + * The value is expected to match what would be returned from + * {@link java.sql.DatabaseMetaData#getDatabaseMajorVersion()}) for + * the underlying database. + * + * @see #JAKARTA_HBM2DDL_DB_NAME */ String JAKARTA_HBM2DDL_DB_MAJOR_VERSION = "jakarta.persistence.database-major-version"; /** - * Specifies the minor version of the underlying database, as would be returned by - * {@link java.sql.DatabaseMetaData#getDatabaseMinorVersion} for the target database. This value is used to - * help more precisely determine how to perform schema generation tasks for the underlying database in cases - * where the combination of {@value #HBM2DDL_DB_NAME} and {@value #HBM2DDL_DB_MAJOR_VERSION} does not provide - * enough distinction. + * Used in conjunction with {@value #JAKARTA_HBM2DDL_DB_NAME} for the + * purpose of determining the Dialect to use when the name does not + * provide enough detail. * - * @see #HBM2DDL_DB_NAME - * @see #HBM2DDL_DB_MAJOR_VERSION + * The value is expected to match what would be returned from + * {@link java.sql.DatabaseMetaData#getDatabaseMinorVersion()}) for + * the underlying database. + * + * @see #JAKARTA_HBM2DDL_DB_NAME */ String JAKARTA_HBM2DDL_DB_MINOR_VERSION = "jakarta.persistence.database-minor-version"; @@ -1909,54 +1755,43 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { String JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE = "jakarta.persistence.schema-generation.drop-script-source"; /** - * For cases where the {@value #HBM2DDL_SCRIPTS_ACTION} value indicates that schema creation commands should - * be written to DDL script file, {@value #HBM2DDL_SCRIPTS_CREATE_TARGET} specifies either a - * {@link java.io.Writer} configured for output of the DDL script or a string specifying the file URL for the DDL - * script. + * For cases where {@value #JAKARTA_HBM2DDL_SCRIPTS_ACTION} indicates that schema creation + * commands should be written to a script file, this setting specifies either a + * {@link java.io.Writer} configured for output of the DDL script or a string specifying + * the file URL for the DDL script. * - * @see #HBM2DDL_SCRIPTS_ACTION + * @see #JAKARTA_HBM2DDL_SCRIPTS_ACTION */ - @SuppressWarnings("JavaDoc") String JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET = "jakarta.persistence.schema-generation.scripts.create-target"; /** - * For cases where the {@value #HBM2DDL_SCRIPTS_ACTION} value indicates that schema drop commands should - * be written to DDL script file, {@value #HBM2DDL_SCRIPTS_DROP_TARGET} specifies either a - * {@link java.io.Writer} configured for output of the DDL script or a string specifying the file URL for the DDL - * script. + * For cases where {@value #JAKARTA_HBM2DDL_SCRIPTS_ACTION} indicates that schema + * drop commands should be written to a script file, this setting specifies either a + * {@link java.io.Writer} configured for output of the DDL script or a string + * specifying the file URL for the DDL script. * - * @see #HBM2DDL_SCRIPTS_ACTION + * @see #JAKARTA_HBM2DDL_SCRIPTS_ACTION */ - @SuppressWarnings("JavaDoc") String JAKARTA_HBM2DDL_SCRIPTS_DROP_TARGET = "jakarta.persistence.schema-generation.scripts.drop-target"; /** - * JPA variant of {@link #HBM2DDL_IMPORT_FILES} - *

- * Specifies a {@link java.io.Reader} configured for reading of the SQL load script or a string designating the - * file {@link java.net.URL} for the SQL load script. - *

- * A "SQL load script" is a script that performs some database initialization (INSERT, etc). + * JPA variant of {@link #HBM2DDL_IMPORT_FILES} for specifying + * a database initialization script to be run as part of schema-export + * + * Specifies a {@link java.io.Reader} configured for reading of the SQL load script + * or a string designating the {@link java.net.URL} for the SQL load script. */ String JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE = "jakarta.persistence.sql-load-script-source"; /** - * The JPA variant of {@link #HBM2DDL_CREATE_NAMESPACES} - *

- * Specifies whether the persistence provider is to create the database schema(s) in addition to creating - * database objects (tables, sequences, constraints, etc). The value of this boolean property should be set - * to {@code true} if the persistence provider is to create schemas in the database or to generate DDL that - * contains "CREATE SCHEMA" commands. If this property is not supplied (or is explicitly {@code false}), the - * provider should not attempt to create database schemas. + * The JPA variant of {@link #HBM2DDL_CREATE_NAMESPACES} used to specify whether database + * schemas used in the mapping model should be created on export in addition to creating the + * tables, sequences, etc. + * + * The default is {@code false}, meaning to not create schemas */ String JAKARTA_HBM2DDL_CREATE_SCHEMAS = "jakarta.persistence.create-database-schemas"; - /** - * @deprecated Use {@link #HBM2DDL_CREATE_SCHEMAS} instead: this variable name had a typo. - */ - @Deprecated - String HBM2DLL_CREATE_SCHEMAS = HBM2DDL_CREATE_SCHEMAS; - /** * Used to specify the {@link org.hibernate.tool.schema.spi.SchemaFilterProvider} to be used by * create, drop, migrate and validate operations on the database schema. SchemaFilterProvider @@ -2229,22 +2064,6 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { */ String AUTO_SESSION_EVENTS_LISTENER = "hibernate.session.events.auto"; - /** - * Global setting for whether NULL parameter bindings should be passed to database - * procedure/function calls as part of {@link org.hibernate.procedure.ProcedureCall} - * handling. Implicitly Hibernate will not pass the NULL, the intention being to allow - * any default argument values to be applied. - *

- * This defines a global setting, which can then be controlled per parameter via - * {@link org.hibernate.procedure.ParameterRegistration#enablePassingNulls(boolean)} - *

- * Values are {@code true} (pass the NULLs) or {@code false} (do not pass the NULLs). - * - * @deprecated (5.3) Hibernate determines it implicitly - */ - @Deprecated - String PROCEDURE_NULL_PARAM_PASSING = "hibernate.proc.param_null_passing"; - /** * [EXPERIMENTAL] Enable instantiation of composite/embedded objects when all of its attribute values are {@code null}. * The default (and historical) behavior is that a {@code null} reference will be used to represent the @@ -2373,21 +2192,6 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { */ String CRITERIA_VALUE_HANDLING_MODE = "hibernate.criteria.value_handling_mode"; - /** - * True/false setting indicating whether the value specified for {@link GeneratedValue#generator()} - * should be used as the sequence/table name when no matching {@link jakarta.persistence.SequenceGenerator} - * or {@link jakarta.persistence.TableGenerator} is found. - * - * The default value is `true` meaning that {@link GeneratedValue#generator()} will be used as the - * sequence/table name by default. Users migrating from earlier versions using the legacy - * `hibernate_sequence` name should disable this setting. - * - * @deprecated As of 6.0 with no replacement - `hibernate_sequence` as a real, implicit exportable name - * is no longer supported. No effect - */ - @Deprecated - String PREFER_GENERATOR_NAME_AS_DEFAULT_SEQUENCE_NAME = "hibernate.model.generator_name_as_sequence_name"; - /** * Should Hibernate's {@link Transaction} behave as * defined by the spec for JPA's {@link jakarta.persistence.EntityTransaction} @@ -2597,4 +2401,311 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * @since 6.0 */ String PREFERRED_BOOLEAN_JDBC_TYPE_CODE = "hibernate.type.perferred_boolean_jdbc_type_code"; + + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Java (javax) Persistence defined settings + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * The name of the {@link jakarta.persistence.spi.PersistenceProvider} implementor + *

+ * See JPA 2 sections 9.4.3 and 8.2.1.4 + * + * @deprecated Use {@link #JAKARTA_PERSISTENCE_PROVIDER} instead + */ + @Deprecated + String JPA_PERSISTENCE_PROVIDER = "javax.persistence.provider"; + + /** + * The type of transactions supported by the entity managers. + *

+ * See JPA 2 sections 9.4.3 and 8.2.1.2 + * + * @deprecated Use {@link #JAKARTA_TRANSACTION_TYPE} instead + */ + @Deprecated + String JPA_TRANSACTION_TYPE = "javax.persistence.transactionType"; + + /** + * The JNDI name of a JTA {@link javax.sql.DataSource}. + *

+ * See JPA 2 sections 9.4.3 and 8.2.1.5 + * + * @deprecated Use {@link #JAKARTA_JTA_DATASOURCE} instead + */ + @Deprecated + String JPA_JTA_DATASOURCE = "javax.persistence.jtaDataSource"; + + /** + * The JNDI name of a non-JTA {@link javax.sql.DataSource}. + *

+ * See JPA 2 sections 9.4.3 and 8.2.1.5 + * + * @deprecated Use {@link #JAKARTA_NON_JTA_DATASOURCE} instead + */ + @Deprecated + String JPA_NON_JTA_DATASOURCE = "javax.persistence.nonJtaDataSource"; + + /** + * The name of a JDBC driver to use to connect to the database. + *

+ * Used in conjunction with {@link #JPA_JDBC_URL}, {@link #JPA_JDBC_USER} and {@link #JPA_JDBC_PASSWORD} + * to define how to make connections to the database in lieu of + * a datasource (either {@link #JPA_JTA_DATASOURCE} or {@link #JPA_NON_JTA_DATASOURCE}). + *

+ * See section 8.2.1.9 + * + * @deprecated Use {@link #JAKARTA_JDBC_DRIVER} instead + */ + @Deprecated + String JPA_JDBC_DRIVER = "javax.persistence.jdbc.driver"; + + /** + * The JDBC connection url to use to connect to the database. + *

+ * Used in conjunction with {@link #JPA_JDBC_DRIVER}, {@link #JPA_JDBC_USER} and {@link #JPA_JDBC_PASSWORD} + * to define how to make connections to the database in lieu of + * a datasource (either {@link #JPA_JTA_DATASOURCE} or {@link #JPA_NON_JTA_DATASOURCE}). + *

+ * See section 8.2.1.9 + * + * @deprecated Use {@link #JAKARTA_JDBC_URL} instead + */ + @Deprecated + String JPA_JDBC_URL = "javax.persistence.jdbc.url"; + + /** + * The JDBC connection user name. + *

+ * Used in conjunction with {@link #JPA_JDBC_DRIVER}, {@link #JPA_JDBC_URL} and {@link #JPA_JDBC_PASSWORD} + * to define how to make connections to the database in lieu of + * a datasource (either {@link #JPA_JTA_DATASOURCE} or {@link #JPA_NON_JTA_DATASOURCE}). + *

+ * See section 8.2.1.9 + * + * @deprecated Use {@link #JAKARTA_JDBC_USER} instead + */ + @Deprecated + String JPA_JDBC_USER = "javax.persistence.jdbc.user"; + + /** + * The JDBC connection password. + *

+ * Used in conjunction with {@link #JPA_JDBC_DRIVER}, {@link #JPA_JDBC_URL} and {@link #JPA_JDBC_USER} + * to define how to make connections to the database in lieu of + * a datasource (either {@link #JPA_JTA_DATASOURCE} or {@link #JPA_NON_JTA_DATASOURCE}). + *

+ * See JPA 2 section 8.2.1.9 + * + * @deprecated Use {@link #JAKARTA_JDBC_PASSWORD} instead + */ + @Deprecated + String JPA_JDBC_PASSWORD = "javax.persistence.jdbc.password"; + + /** + * Used to indicate whether second-level (what JPA terms shared cache) caching is + * enabled as per the rules defined in JPA 2 section 3.1.7. + *

+ * See JPA 2 sections 9.4.3 and 8.2.1.7 + * @see jakarta.persistence.SharedCacheMode + * + * @deprecated Use {@link #JAKARTA_SHARED_CACHE_MODE} instead + */ + @Deprecated + String JPA_SHARED_CACHE_MODE = "javax.persistence.sharedCache.mode"; + + /** + * NOTE : Not a valid EMF property... + *

+ * Used to indicate if the provider should attempt to retrieve requested data + * in the shared cache. + * + * @see jakarta.persistence.CacheRetrieveMode + * + * @deprecated Use {@link #JAKARTA_SHARED_CACHE_RETRIEVE_MODE} instead + */ + @Deprecated + String JPA_SHARED_CACHE_RETRIEVE_MODE ="javax.persistence.cache.retrieveMode"; + + /** + * NOTE : Not a valid EMF property... + *

+ * Used to indicate if the provider should attempt to store data loaded from the database + * in the shared cache. + * + * @see jakarta.persistence.CacheStoreMode + * + * @deprecated Use {@link #JAKARTA_SHARED_CACHE_STORE_MODE} instead + */ + @Deprecated + String JPA_SHARED_CACHE_STORE_MODE ="javax.persistence.cache.storeMode"; + + /** + * Used to indicate what form of automatic validation is in effect as per rules defined + * in JPA 2 section 3.6.1.1 + *

+ * See JPA 2 sections 9.4.3 and 8.2.1.8 + * @see jakarta.persistence.ValidationMode + * + * @deprecated Use {@link #JAKARTA_VALIDATION_MODE} instead + */ + @Deprecated + String JPA_VALIDATION_MODE = "javax.persistence.validation.mode"; + + /** + * Used to pass along any discovered validator factory. + * + * @deprecated Use {@link #JAKARTA_VALIDATION_FACTORY} instead + */ + @Deprecated + String JPA_VALIDATION_FACTORY = "javax.persistence.validation.factory"; + + /** + * Used to coordinate with bean validators + *

+ * See JPA 2 section 8.2.1.9 + * + * @deprecated Use {@link #JAKARTA_PERSIST_VALIDATION_GROUP} instead + */ + @Deprecated + String JPA_PERSIST_VALIDATION_GROUP = "javax.persistence.validation.group.pre-persist"; + + /** + * Used to coordinate with bean validators + *

+ * See JPA 2 section 8.2.1.9 + * + * @deprecated Use {@link #JAKARTA_UPDATE_VALIDATION_GROUP} instead + */ + @Deprecated + String JPA_UPDATE_VALIDATION_GROUP = "javax.persistence.validation.group.pre-update"; + + /** + * Used to coordinate with bean validators + *

+ * See JPA 2 section 8.2.1.9 + * + * @deprecated Use {@link #JAKARTA_REMOVE_VALIDATION_GROUP} instead + */ + @Deprecated + String JPA_REMOVE_VALIDATION_GROUP = "javJPAax.persistence.validation.group.pre-remove"; + + /** + * Used to request (hint) a pessimistic lock scope. + *

+ * See JPA 2 sections 8.2.1.9 and 3.4.4.3 + * + * @deprecated Use {@link #JAKARTA_LOCK_SCOPE} instead + */ + @Deprecated + String JPA_LOCK_SCOPE = "javax.persistence.lock.scope"; + + /** + * Used to request (hint) a pessimistic lock timeout (in milliseconds). + *

+ * See JPA 2 sections 8.2.1.9 and 3.4.4.3 + * + * @deprecated Use {@link #JAKARTA_LOCK_TIMEOUT} instead + */ + @Deprecated + String JPA_LOCK_TIMEOUT = "javax.persistence.lock.timeout"; + + /** + * Used to pass along the CDI BeanManager, if any, to be used. + * + * According to JPA, strictly, the BeanManager should be passed in + * at boot-time and be ready for use at that time. However not all + * environments can do this (WildFly e.g.). To accommodate such + * environments, Hibernate provides 2 options: + * + * * a proprietary CDI extension SPI (that we have proposed to + * the CDI spec group as a standard option) that can be used + * to provide delayed BeanManager access. To use this solution, + * the reference passed as the BeanManager during bootstrap + * should be typed as {@link ExtendedBeanManager} + * * delayed access to the BeanManager reference. Here, Hibernate + * will not access the reference passed as the BeanManager during + * bootstrap until it is first needed. Note however that this has + * the effect of delaying any deployment problems until after + * bootstrapping. + * + * This setting is used to configure Hibernate ORM's access to + * the BeanManager (either directly or via {@link ExtendedBeanManager}). + * + * @deprecated Use {@link #JAKARTA_CDI_BEAN_MANAGER} instead + */ + @Deprecated + String CDI_BEAN_MANAGER = "javax.persistence.bean.manager"; + + + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // pulled from jpa.AvailableSettings + + /** + * Used to determine flush mode. + */ + String FLUSH_MODE = "org.hibernate.flushMode"; + + String CFG_XML_FILE = "hibernate.cfg_xml_file"; + String ORM_XML_FILES = "hibernate.orm_xml_files"; + String HBM_XML_FILES = "hibernate.hbm_xml_files"; + String LOADED_CLASSES = "hibernate.loaded_classes"; + + /** + * Event configuration should follow the following pattern + * hibernate.event.listener.[eventType] f.q.c.n.EventListener1, f.q.c.n.EventListener12 ... + */ + String EVENT_LISTENER_PREFIX = "hibernate.event.listener"; + + /** + * Caching configuration should follow the following pattern + * {@code hibernate.ejb.classcache. usage[, region]} + * where usage is the cache strategy used and region the cache region name + */ + String CLASS_CACHE_PREFIX = "hibernate.classcache"; + + /** + * Caching configuration should follow the following pattern + * {@code hibernate.ejb.collectioncache.. usage[, region]} + * where usage is the cache strategy used and region the cache region name + */ + String COLLECTION_CACHE_PREFIX = "hibernate.collectioncache"; + + /** + * Enable dirty tracking feature in runtime bytecode enhancement + */ + String ENHANCER_ENABLE_DIRTY_TRACKING = "hibernate.enhancer.enableDirtyTracking"; + + /** + * Enable lazy loading feature in runtime bytecode enhancement + */ + String ENHANCER_ENABLE_LAZY_INITIALIZATION = "hibernate.enhancer.enableLazyInitialization"; + + /** + * Enable association management feature in runtime bytecode enhancement + */ + String ENHANCER_ENABLE_ASSOCIATION_MANAGEMENT = "hibernate.enhancer.enableAssociationManagement"; + + /** + * Used to pass along the name of the persistence unit. + */ + String PERSISTENCE_UNIT_NAME = "hibernate.persistenceUnitName"; + + /** + * SessionFactoryObserver class name, the class must have a no-arg constructor + */ + String SESSION_FACTORY_OBSERVER = "hibernate.session_factory_observer"; + + /** + * IdentifierGeneratorStrategyProvider class name, the class must have a no-arg constructor + */ + String IDENTIFIER_GENERATOR_STRATEGY_PROVIDER = "hibernate.identifier_generator_strategy_provider"; + + /** + * Whether to discard persistent context on {@link org.hibernate.Session#close} / + * {@link jakarta.persistence.EntityManager#close}. + * + * The default (and spec compliant behavior) is false + */ + String DISCARD_PC_ON_CLOSE = "hibernate.discard_pc_on_close"; } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryHintDefinition.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryHintDefinition.java index e12bf50ada..8c6e58598b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryHintDefinition.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryHintDefinition.java @@ -135,7 +135,7 @@ public class QueryHintDefinition { LockModeType lockModeType = namedQueryAnnotation.lockMode(); Integer lockTimeoutHint = getInteger( AvailableSettings.JPA_LOCK_TIMEOUT ); if ( lockTimeoutHint == null ) { - lockTimeoutHint = getInteger( AvailableSettings.JAKARTA_JPA_LOCK_TIMEOUT ); + lockTimeoutHint = getInteger( AvailableSettings.JAKARTA_LOCK_TIMEOUT ); } Boolean followOnLocking = getBoolean( QueryHints.FOLLOW_ON_LOCKING ); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java b/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java index 66bd31c226..0b93c215b5 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java @@ -557,7 +557,7 @@ class TypeSafeActivator { } }, cfgService.getSetting( - AvailableSettings.JAKARTA_JPA_VALIDATION_FACTORY, + AvailableSettings.JAKARTA_VALIDATION_FACTORY, new ConfigurationService.Converter() { @Override public ValidatorFactory convert(Object value) { @@ -569,7 +569,7 @@ class TypeSafeActivator { String.format( Locale.ENGLISH, "ValidatorFactory reference (provided via `%s` setting) was not castable to %s : %s", - AvailableSettings.JAKARTA_JPA_VALIDATION_FACTORY, + AvailableSettings.JAKARTA_VALIDATION_FACTORY, ValidatorFactory.class.getName(), value.getClass().getName() ) diff --git a/hibernate-core/src/main/java/org/hibernate/ejb/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/ejb/AvailableSettings.java deleted file mode 100644 index cdc96087b9..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/ejb/AvailableSettings.java +++ /dev/null @@ -1,14 +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 . - */ -package org.hibernate.ejb; - -/** - * @deprecated use org.hibernate.jpa.AvailableSettings - */ -@Deprecated -public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { -} diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java index ad3bb35d17..22a8bf9a8a 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java @@ -24,6 +24,8 @@ import org.hibernate.engine.jdbc.dialect.spi.DialectFactory; import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo; import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.log.DeprecationLogger; +import org.hibernate.internal.util.NullnessHelper; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.service.spi.ServiceRegistryImplementor; @@ -62,13 +64,32 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator configurationValues.get( AvailableSettings.JAKARTA_HBM2DDL_DB_NAME ), + () -> { + final Object value = configurationValues.get( AvailableSettings.DIALECT_DB_NAME ); + if ( value != null ) { + DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( + AvailableSettings.DIALECT_DB_NAME, + AvailableSettings.JAKARTA_HBM2DDL_DB_NAME + ); + } + return value; + } + ); + + NullnessHelper.coalesceSuppliedValues( + () -> AvailableSettings.JAKARTA_HBM2DDL_DB_VERSION, + () -> AvailableSettings.DIALECT_DB_VERSION + ); + + if ( dbName != null ) { return new JdbcEnvironmentImpl( registry, dialectFactory.buildDialect( configurationValues, () -> new DialectResolutionInfo() { @Override public String getDatabaseName() { - return (String) configurationValues.get( AvailableSettings.DIALECT_DB_NAME ); + return (String) dbName; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java index 1efc0b1414..0e068d8fa2 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java @@ -382,16 +382,11 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab String fallbackTableName = DEF_TABLE; - final Boolean preferGeneratorNameAsDefaultName = serviceRegistry.getService( ConfigurationService.class ) - .getSetting( AvailableSettings.PREFER_GENERATOR_NAME_AS_DEFAULT_SEQUENCE_NAME, StandardConverters.BOOLEAN, true ); - if ( preferGeneratorNameAsDefaultName ) { - final String generatorName = params.getProperty( IdentifierGenerator.GENERATOR_NAME ); - if ( StringHelper.isNotEmpty( generatorName ) ) { - fallbackTableName = generatorName; - } + final String generatorName = params.getProperty( IdentifierGenerator.GENERATOR_NAME ); + if ( StringHelper.isNotEmpty( generatorName ) ) { + fallbackTableName = generatorName; } - String tableName = ConfigurationHelper.getString( TABLE_PARAM, params, fallbackTableName ); if ( tableName.contains( "." ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java b/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java index 2dcfeeb7b9..c90112c2db 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java @@ -21,6 +21,7 @@ import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; import org.hibernate.boot.spi.SessionFactoryOptions; import org.hibernate.cfg.BaselineSessionEventsListenerBuilder; import org.hibernate.cfg.Environment; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider; @@ -59,7 +60,6 @@ import org.hibernate.event.spi.RefreshEventListener; import org.hibernate.event.spi.ReplicateEventListener; import org.hibernate.event.spi.ResolveNaturalIdEventListener; import org.hibernate.event.spi.SaveOrUpdateEventListener; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.QueryHints; import org.hibernate.jpa.internal.util.CacheModeHelper; import org.hibernate.jpa.internal.util.ConfigurationHelper; @@ -68,10 +68,10 @@ import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_LOCK_SCOPE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_LOCK_TIMEOUT; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_SHARED_CACHE_STORE_MODE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_SCOPE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_TIMEOUT; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_RETRIEVE_MODE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_STORE_MODE; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_SCOPE; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_TIMEOUT; import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_RETRIEVE_MODE; @@ -280,25 +280,25 @@ public final class FastSessionServices { //Static defaults: p.putIfAbsent( AvailableSettings.FLUSH_MODE, FlushMode.AUTO.name() ); p.putIfAbsent( JPA_LOCK_SCOPE, PessimisticLockScope.EXTENDED.name() ); - p.putIfAbsent( JAKARTA_JPA_LOCK_SCOPE, PessimisticLockScope.EXTENDED.name() ); + p.putIfAbsent( JAKARTA_LOCK_SCOPE, PessimisticLockScope.EXTENDED.name() ); p.putIfAbsent( JPA_LOCK_TIMEOUT, LockOptions.WAIT_FOREVER ); - p.putIfAbsent( JAKARTA_JPA_LOCK_TIMEOUT, LockOptions.WAIT_FOREVER ); + p.putIfAbsent( JAKARTA_LOCK_TIMEOUT, LockOptions.WAIT_FOREVER ); p.putIfAbsent( JPA_SHARED_CACHE_RETRIEVE_MODE, CacheModeHelper.DEFAULT_RETRIEVE_MODE ); - p.putIfAbsent( JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE, CacheModeHelper.DEFAULT_RETRIEVE_MODE ); + p.putIfAbsent( JAKARTA_SHARED_CACHE_RETRIEVE_MODE, CacheModeHelper.DEFAULT_RETRIEVE_MODE ); p.putIfAbsent( JPA_SHARED_CACHE_STORE_MODE, CacheModeHelper.DEFAULT_STORE_MODE ); - p.putIfAbsent( JAKARTA_JPA_SHARED_CACHE_STORE_MODE, CacheModeHelper.DEFAULT_STORE_MODE ); + p.putIfAbsent( JAKARTA_SHARED_CACHE_STORE_MODE, CacheModeHelper.DEFAULT_STORE_MODE ); //Defaults defined by SessionFactory configuration: final String[] ENTITY_MANAGER_SPECIFIC_PROPERTIES = { JPA_LOCK_SCOPE, - JAKARTA_JPA_LOCK_SCOPE, + JAKARTA_LOCK_SCOPE, JPA_LOCK_TIMEOUT, - JAKARTA_JPA_LOCK_TIMEOUT, + JAKARTA_LOCK_TIMEOUT, AvailableSettings.FLUSH_MODE, JPA_SHARED_CACHE_RETRIEVE_MODE, - JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE, + JAKARTA_SHARED_CACHE_RETRIEVE_MODE, JPA_SHARED_CACHE_STORE_MODE, - JAKARTA_JPA_SHARED_CACHE_STORE_MODE, + JAKARTA_SHARED_CACHE_STORE_MODE, QueryHints.SPEC_HINT_TIMEOUT, QueryHints.JAKARTA_SPEC_HINT_TIMEOUT }; @@ -342,7 +342,7 @@ public final class FastSessionServices { private static CacheRetrieveMode determineCacheRetrieveMode(Map settings) { final CacheRetrieveMode cacheRetrieveMode = (CacheRetrieveMode) settings.get( JPA_SHARED_CACHE_RETRIEVE_MODE ); if ( cacheRetrieveMode == null ) { - return (CacheRetrieveMode) settings.get( JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE ); + return (CacheRetrieveMode) settings.get( JAKARTA_SHARED_CACHE_RETRIEVE_MODE ); } return cacheRetrieveMode; } @@ -350,7 +350,7 @@ public final class FastSessionServices { private static CacheStoreMode determineCacheStoreMode(Map settings) { final CacheStoreMode cacheStoreMode = (CacheStoreMode) settings.get( JPA_SHARED_CACHE_STORE_MODE ); if ( cacheStoreMode == null ) { - return ( CacheStoreMode ) settings.get( JAKARTA_JPA_SHARED_CACHE_STORE_MODE ); + return ( CacheStoreMode ) settings.get( JAKARTA_SHARED_CACHE_STORE_MODE ); } return cacheStoreMode; } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index a75eb8396e..13d3a8ce4e 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -237,14 +237,14 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { this.properties = new HashMap<>(); this.properties.putAll( serviceRegistry.getService( ConfigurationService.class ).getSettings() ); if ( !properties.containsKey( AvailableSettings.JPA_VALIDATION_FACTORY ) - && !properties.containsKey( AvailableSettings.JAKARTA_JPA_VALIDATION_FACTORY ) ) { + && !properties.containsKey( AvailableSettings.JAKARTA_VALIDATION_FACTORY ) ) { if ( getSessionFactoryOptions().getValidatorFactoryReference() != null ) { properties.put( AvailableSettings.JPA_VALIDATION_FACTORY, getSessionFactoryOptions().getValidatorFactoryReference() ); properties.put( - AvailableSettings.JAKARTA_JPA_VALIDATION_FACTORY, + AvailableSettings.JAKARTA_VALIDATION_FACTORY, getSessionFactoryOptions().getValidatorFactoryReference() ); } @@ -1644,8 +1644,8 @@ public class SessionFactoryImpl implements SessionFactoryImplementor { private void maskOutSensitiveInformation(Map props) { maskOutIfSet( props, AvailableSettings.JPA_JDBC_USER ); maskOutIfSet( props, AvailableSettings.JPA_JDBC_PASSWORD ); - maskOutIfSet( props, AvailableSettings.JAKARTA_JPA_JDBC_USER ); - maskOutIfSet( props, AvailableSettings.JAKARTA_JPA_JDBC_PASSWORD ); + maskOutIfSet( props, AvailableSettings.JAKARTA_JDBC_USER ); + maskOutIfSet( props, AvailableSettings.JAKARTA_JDBC_PASSWORD ); maskOutIfSet( props, AvailableSettings.USER ); maskOutIfSet( props, AvailableSettings.PASS ); } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index ebfddf180c..972ff59d0d 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -22,16 +22,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import jakarta.persistence.CacheRetrieveMode; -import jakarta.persistence.CacheStoreMode; -import jakarta.persistence.EntityGraph; -import jakarta.persistence.EntityManager; -import jakarta.persistence.EntityNotFoundException; -import jakarta.persistence.FlushModeType; -import jakarta.persistence.LockModeType; -import jakarta.persistence.PersistenceException; -import jakarta.persistence.StoredProcedureQuery; -import jakarta.persistence.TransactionRequiredException; import org.hibernate.CacheMode; import org.hibernate.Filter; @@ -59,6 +49,7 @@ import org.hibernate.TransientObjectException; import org.hibernate.TypeMismatchException; import org.hibernate.UnknownProfileException; import org.hibernate.UnresolvableObjectException; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.engine.internal.StatefulPersistenceContext; import org.hibernate.engine.jdbc.LobCreator; @@ -112,7 +103,6 @@ import org.hibernate.graph.GraphSemantic; import org.hibernate.graph.internal.RootGraphImpl; import org.hibernate.graph.spi.RootGraphImplementor; import org.hibernate.internal.util.ExceptionHelper; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.QueryHints; import org.hibernate.jpa.internal.util.CacheModeHelper; import org.hibernate.jpa.internal.util.ConfigurationHelper; @@ -140,10 +130,21 @@ import org.hibernate.stat.SessionStatistics; import org.hibernate.stat.internal.SessionStatisticsImpl; import org.hibernate.stat.spi.StatisticsImplementor; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_LOCK_SCOPE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_LOCK_TIMEOUT; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_SHARED_CACHE_STORE_MODE; +import jakarta.persistence.CacheRetrieveMode; +import jakarta.persistence.CacheStoreMode; +import jakarta.persistence.EntityGraph; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityNotFoundException; +import jakarta.persistence.FlushModeType; +import jakarta.persistence.LockModeType; +import jakarta.persistence.PersistenceException; +import jakarta.persistence.StoredProcedureQuery; +import jakarta.persistence.TransactionRequiredException; + +import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_SCOPE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_TIMEOUT; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_RETRIEVE_MODE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_STORE_MODE; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_SCOPE; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_TIMEOUT; import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_RETRIEVE_MODE; @@ -281,10 +282,10 @@ public class SessionImpl final Object lockTimeout; final Object jpaLockTimeout = getSessionProperty( JPA_LOCK_TIMEOUT ); if ( jpaLockTimeout == null ) { - lockTimeout = getSessionProperty( JAKARTA_JPA_LOCK_TIMEOUT ); + lockTimeout = getSessionProperty( JAKARTA_LOCK_TIMEOUT ); } else if ( Integer.valueOf( LockOptions.WAIT_FOREVER ).equals( jpaLockTimeout ) ) { - final Object jakartaLockTimeout = getSessionProperty( JAKARTA_JPA_LOCK_TIMEOUT ); + final Object jakartaLockTimeout = getSessionProperty( JAKARTA_LOCK_TIMEOUT ); if ( jakartaLockTimeout == null ) { lockTimeout = jpaLockTimeout; } @@ -2361,7 +2362,7 @@ public class SessionImpl private static CacheRetrieveMode determineCacheRetrieveMode(Map settings) { final CacheRetrieveMode cacheRetrieveMode = (CacheRetrieveMode) settings.get( JPA_SHARED_CACHE_RETRIEVE_MODE ); if ( cacheRetrieveMode == null ) { - return (CacheRetrieveMode) settings.get( JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE ); + return (CacheRetrieveMode) settings.get( JAKARTA_SHARED_CACHE_RETRIEVE_MODE ); } return cacheRetrieveMode; } @@ -2369,7 +2370,7 @@ public class SessionImpl private static CacheStoreMode determineCacheStoreMode(Map settings) { final CacheStoreMode cacheStoreMode = (CacheStoreMode) settings.get( JPA_SHARED_CACHE_STORE_MODE ); if ( cacheStoreMode == null ) { - return ( CacheStoreMode ) settings.get( JAKARTA_JPA_SHARED_CACHE_STORE_MODE ); + return ( CacheStoreMode ) settings.get( JAKARTA_SHARED_CACHE_STORE_MODE ); } return cacheStoreMode; } @@ -2530,13 +2531,13 @@ public class SessionImpl setHibernateFlushMode( ConfigurationHelper.getFlushMode( value, FlushMode.AUTO ) ); } else if ( JPA_LOCK_SCOPE.equals( propertyName ) || JPA_LOCK_TIMEOUT.equals( propertyName ) - || JAKARTA_JPA_LOCK_SCOPE.equals( propertyName ) || JAKARTA_JPA_LOCK_TIMEOUT.equals( propertyName ) ) { + || JAKARTA_LOCK_SCOPE.equals( propertyName ) || JAKARTA_LOCK_TIMEOUT.equals( propertyName ) ) { LockOptionsHelper.applyPropertiesToLockOptions( properties, this::getLockOptionsForWrite ); } else if ( JPA_SHARED_CACHE_RETRIEVE_MODE.equals( propertyName ) || JPA_SHARED_CACHE_STORE_MODE.equals( propertyName ) - || JAKARTA_JPA_SHARED_CACHE_RETRIEVE_MODE.equals( propertyName ) - || JAKARTA_JPA_SHARED_CACHE_STORE_MODE.equals( propertyName ) ) { + || JAKARTA_SHARED_CACHE_RETRIEVE_MODE.equals( propertyName ) + || JAKARTA_SHARED_CACHE_STORE_MODE.equals( propertyName ) ) { setCacheMode( CacheModeHelper.interpretCacheMode( determineCacheStoreMode( properties ), diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/jpa/AvailableSettings.java deleted file mode 100644 index 4c90609c67..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/jpa/AvailableSettings.java +++ /dev/null @@ -1,356 +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 . - */ -package org.hibernate.jpa; - -/** - * Defines the available HEM settings, both JPA-defined as well as Hibernate-specific - *

- * NOTE : Does *not* include {@link org.hibernate.cfg.Environment} values. - * - * @author Steve Ebersole - */ -public interface AvailableSettings { - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // JPA-defined settings - general - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_TRANSACTION_TYPE} instead - */ - @Deprecated - String TRANSACTION_TYPE = org.hibernate.cfg.AvailableSettings.JPA_TRANSACTION_TYPE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_JTA_DATASOURCE} instead - */ - @Deprecated - String JTA_DATASOURCE = org.hibernate.cfg.AvailableSettings.JPA_JTA_DATASOURCE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_NON_JTA_DATASOURCE} instead - */ - @Deprecated - String NON_JTA_DATASOURCE = org.hibernate.cfg.AvailableSettings.JPA_NON_JTA_DATASOURCE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_JDBC_DRIVER} instead - */ - @Deprecated - String JDBC_DRIVER = org.hibernate.cfg.AvailableSettings.JPA_JDBC_DRIVER; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_JDBC_URL} instead - */ - @Deprecated - String JDBC_URL = org.hibernate.cfg.AvailableSettings.JPA_JDBC_URL; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_JDBC_USER} instead - */ - @Deprecated - String JDBC_USER = org.hibernate.cfg.AvailableSettings.JPA_JDBC_USER; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_JDBC_PASSWORD} instead - */ - @Deprecated - String JDBC_PASSWORD = org.hibernate.cfg.AvailableSettings.JPA_JDBC_PASSWORD; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_VALIDATION_MODE} instead - */ - @Deprecated - String VALIDATION_MODE = org.hibernate.cfg.AvailableSettings.JPA_VALIDATION_MODE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_VALIDATION_FACTORY} instead - */ - @Deprecated - String VALIDATION_FACTORY = org.hibernate.cfg.AvailableSettings.JPA_VALIDATION_FACTORY; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_PERSIST_VALIDATION_GROUP} instead - */ - @Deprecated - String PERSIST_VALIDATION_GROUP = org.hibernate.cfg.AvailableSettings.JPA_PERSIST_VALIDATION_GROUP; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_UPDATE_VALIDATION_GROUP} instead - */ - @Deprecated - String UPDATE_VALIDATION_GROUP = org.hibernate.cfg.AvailableSettings.JPA_UPDATE_VALIDATION_GROUP; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_REMOVE_VALIDATION_GROUP} instead - */ - @Deprecated - String REMOVE_VALIDATION_GROUP = org.hibernate.cfg.AvailableSettings.JPA_REMOVE_VALIDATION_GROUP; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_LOCK_SCOPE} instead - */ - @Deprecated - String LOCK_SCOPE = org.hibernate.cfg.AvailableSettings.JPA_LOCK_SCOPE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#JPA_LOCK_TIMEOUT} instead - */ - @Deprecated - String LOCK_TIMEOUT = org.hibernate.cfg.AvailableSettings.JPA_LOCK_TIMEOUT; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#CDI_BEAN_MANAGER} instead - */ - @Deprecated - String CDI_BEAN_MANAGER = org.hibernate.cfg.AvailableSettings.CDI_BEAN_MANAGER; - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // JPA-defined settings - schema export - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_CREATE_SOURCE} instead - */ - @Deprecated - String SCHEMA_GEN_CREATE_SOURCE = org.hibernate.cfg.AvailableSettings.HBM2DDL_CREATE_SOURCE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_DROP_SOURCE} instead - */ - @Deprecated - String SCHEMA_GEN_DROP_SOURCE = org.hibernate.cfg.AvailableSettings.HBM2DDL_DROP_SOURCE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_CREATE_SCRIPT_SOURCE} instead - */ - @Deprecated - String SCHEMA_GEN_CREATE_SCRIPT_SOURCE = org.hibernate.cfg.AvailableSettings.HBM2DDL_CREATE_SCRIPT_SOURCE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_DROP_SCRIPT_SOURCE} instead - */ - @Deprecated - String SCHEMA_GEN_DROP_SCRIPT_SOURCE = org.hibernate.cfg.AvailableSettings.HBM2DDL_DROP_SCRIPT_SOURCE; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_DATABASE_ACTION} instead - */ - @Deprecated - String SCHEMA_GEN_DATABASE_ACTION = org.hibernate.cfg.AvailableSettings.HBM2DDL_DATABASE_ACTION; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_SCRIPTS_ACTION} instead - */ - @Deprecated - String SCHEMA_GEN_SCRIPTS_ACTION = org.hibernate.cfg.AvailableSettings.HBM2DDL_SCRIPTS_ACTION; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_SCRIPTS_CREATE_TARGET} instead - */ - @Deprecated - String SCHEMA_GEN_SCRIPTS_CREATE_TARGET = org.hibernate.cfg.AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_SCRIPTS_DROP_TARGET} instead - */ - @Deprecated - String SCHEMA_GEN_SCRIPTS_DROP_TARGET = org.hibernate.cfg.AvailableSettings.HBM2DDL_SCRIPTS_DROP_TARGET; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_CREATE_NAMESPACES} - * or {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_CREATE_SCHEMAS} instead - */ - @Deprecated - String SCHEMA_GEN_CREATE_SCHEMAS = org.hibernate.cfg.AvailableSettings.HBM2DDL_CREATE_NAMESPACES; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_CONNECTION} instead - */ - @Deprecated - String SCHEMA_GEN_CONNECTION = org.hibernate.cfg.AvailableSettings.HBM2DDL_CONNECTION; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#DIALECT_DB_NAME} instead - */ - @Deprecated - String SCHEMA_GEN_DB_NAME = org.hibernate.cfg.AvailableSettings.DIALECT_DB_NAME; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#DIALECT_DB_MAJOR_VERSION} instead - */ - @Deprecated - String SCHEMA_GEN_DB_MAJOR_VERSION = org.hibernate.cfg.AvailableSettings.DIALECT_DB_MAJOR_VERSION; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#DIALECT_DB_MINOR_VERSION} instead - */ - @Deprecated - String SCHEMA_GEN_DB_MINOR_VERSION = org.hibernate.cfg.AvailableSettings.DIALECT_DB_MINOR_VERSION; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#HBM2DDL_LOAD_SCRIPT_SOURCE} instead - */ - @Deprecated - String SCHEMA_GEN_LOAD_SCRIPT_SOURCE = org.hibernate.cfg.AvailableSettings.HBM2DDL_LOAD_SCRIPT_SOURCE; - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Hibernate specific settings - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - /** - * Setting that indicates whether to build the JPA types. Accepts - * 3 values:

    - *
  • - * enabled - Do the build - *
  • - *
  • - * disabled - Do not do the build - *
  • - *
  • - * ignoreUnsupported - Do the build, but ignore any non-JPA features that would otherwise - * result in a failure. - *
  • - *
- * - * @deprecated use {@link org.hibernate.cfg.AvailableSettings#STATIC_METAMODEL_POPULATION} instead - */ - @Deprecated - String JPA_METAMODEL_POPULATION = "hibernate.ejb.metamodel.population"; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#INTERCEPTOR} instead - */ - @Deprecated - String INTERCEPTOR = "hibernate.ejb.interceptor"; - - /** - * @deprecated (since 5.2) use {@link org.hibernate.cfg.AvailableSettings#SESSION_SCOPED_INTERCEPTOR} instead - */ - @Deprecated - String SESSION_INTERCEPTOR = "hibernate.ejb.interceptor.session_scoped"; - - /** - * Query hint (aka {@link jakarta.persistence.Query#setHint}) for applying - * an alias specific lock mode (aka {@link org.hibernate.Query#setLockMode}). - *

- * Either {@link org.hibernate.LockMode} or {@link jakarta.persistence.LockModeType} - * are accepted. Also the String names of either are accepted as well. null - * is additionally accepted as meaning {@link org.hibernate.LockMode#NONE}. - *

- * Usage is to concatenate this setting name and the alias name together, separated - * by a dot. For exampleQuery.setHint( "org.hibernate.lockMode.a", someLockMode ) - * would apply someLockMode to the alias "a". - */ - //Use the org.hibernate prefix. instead of hibernate. as it is a query hint se QueryHints - String ALIAS_SPECIFIC_LOCK_MODE = "org.hibernate.lockMode"; - - /** - * cfg.xml configuration file used - */ - String CFG_FILE = "hibernate.ejb.cfgfile"; - - /** - * Caching configuration should follow the following pattern - * {@code hibernate.ejb.classcache. usage[, region]} - * where usage is the cache strategy used and region the cache region name - */ - String CLASS_CACHE_PREFIX = "hibernate.ejb.classcache"; - - /** - * Caching configuration should follow the following pattern - * {@code hibernate.ejb.collectioncache.. usage[, region]} - * where usage is the cache strategy used and region the cache region name - */ - String COLLECTION_CACHE_PREFIX = "hibernate.ejb.collectioncache"; - - /** - * SessionFactoryObserver class name, the class must have a no-arg constructor - */ - String SESSION_FACTORY_OBSERVER = "hibernate.ejb.session_factory_observer"; - - /** - * IdentifierGeneratorStrategyProvider class name, the class must have a no-arg constructor - */ - String IDENTIFIER_GENERATOR_STRATEGY_PROVIDER = "hibernate.ejb.identifier_generator_strategy_provider"; - - /** - * Event configuration should follow the following pattern - * hibernate.ejb.event.[eventType] f.q.c.n.EventListener1, f.q.c.n.EventListener12 ... - */ - String EVENT_LISTENER_PREFIX = "hibernate.ejb.event"; - - /** - * Enable dirty tracking feature in runtime bytecode enhancement - */ - String ENHANCER_ENABLE_DIRTY_TRACKING = "hibernate.enhancer.enableDirtyTracking"; - - /** - * Enable lazy loading feature in runtime bytecode enhancement - */ - String ENHANCER_ENABLE_LAZY_INITIALIZATION = "hibernate.enhancer.enableLazyInitialization"; - - /** - * Enable association management feature in runtime bytecode enhancement - */ - String ENHANCER_ENABLE_ASSOCIATION_MANAGEMENT = "hibernate.enhancer.enableAssociationManagement"; - - /** - * Whether or not discard persistent context on entityManager.close() - * The EJB3 compliant and default choice is false - */ - String DISCARD_PC_ON_CLOSE = "hibernate.ejb.discard_pc_on_close"; - - - /** - * Used to determine flush mode. - */ - //Use the org.hibernate prefix. instead of hibernate. as it is a query hint se QueryHints - String FLUSH_MODE = "org.hibernate.flushMode"; - - - /** - * EntityManagerFactory name - */ - String ENTITY_MANAGER_FACTORY_NAME = "hibernate.ejb.entitymanager_factory_name"; - - - /** - * List of classes names - * Internal use only - */ - String XML_FILE_NAMES = "hibernate.ejb.xml_files"; - String HBXML_FILES = "hibernate.hbmxml.files"; - String LOADED_CLASSES = "hibernate.ejb.loaded.classes"; - - - /** - * Used to pass along the name of the persistence unit. - */ - String PERSISTENCE_UNIT_NAME = "hibernate.ejb.persistenceUnitName"; - - /** - * Defines delayed access to CDI BeanManager. Starting in 5.1 the preferred means for CDI - * bootstrapping is through org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager - * - * @since 5.0.8 - */ - String DELAY_CDI_ACCESS = "hibernate.delay_cdi_access"; - - /** - * Setting that allows access to the underlying {@link org.hibernate.Transaction}, even - * when using a JTA since normal JPA operations prohibit this behavior. - *

- * Values are {@code true} grants access, {@code false} does not. - *

- * The default behavior is to allow access unless the session is bootstrapped via JPA. - */ - String ALLOW_JTA_TRANSACTION_ACCESS = "hibernate.jta.allowTransactionAccess"; -} diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/HibernateEntityManagerFactory.java b/hibernate-core/src/main/java/org/hibernate/jpa/HibernateEntityManagerFactory.java index 8d9f135221..6b5fd06f4f 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/HibernateEntityManagerFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/HibernateEntityManagerFactory.java @@ -8,14 +8,15 @@ package org.hibernate.jpa; import java.io.Serializable; import java.util.List; -import jakarta.persistence.EntityGraph; -import jakarta.persistence.EntityManagerFactory; -import jakarta.persistence.metamodel.EntityType; import org.hibernate.Metamodel; import org.hibernate.boot.spi.SessionFactoryOptions; import org.hibernate.engine.spi.SessionFactoryImplementor; +import jakarta.persistence.EntityGraph; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.metamodel.EntityType; + /** * Contract giving access to the underlying {@link org.hibernate.SessionFactory} from an {@link jakarta.persistence.EntityManagerFactory} * @@ -25,18 +26,6 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; */ @Deprecated public interface HibernateEntityManagerFactory extends EntityManagerFactory, Serializable { - /** - * Obtain the underlying Hibernate SessionFactory. - * - * @return The underlying Hibernate SessionFactory - * - * @deprecated The expectation is that SessionFactory implementors also implement EntityManagerFactory; so this call - * really should just return {@code this} - */ - @Deprecated - default SessionFactoryImplementor getSessionFactory() { - return (SessionFactoryImplementor) this; - } /** * Find all {@code EntityGraph}s associated with a given entity type. @@ -51,6 +40,21 @@ public interface HibernateEntityManagerFactory extends EntityManagerFactory, Ser @Override Metamodel getMetamodel(); + /** + * Obtain the underlying Hibernate SessionFactory. + * + * @return The underlying Hibernate SessionFactory + * + * @deprecated The expectation is that SessionFactory implementors also implement + * EntityManagerFactory; so this call really should just return {@code this}. As an + * alternative, call {@link EntityManagerFactory#unwrap} passing {@code SessionFactoryImplementor.class} + * + */ + @Deprecated + default SessionFactoryImplementor getSessionFactory() { + return (SessionFactoryImplementor) this; + } + /** * Returns the name of the factory. The name is either can be specified via the property hibernate.ejb.entitymanager_factory_name. * If the property is not set the persistence unit name is used. If persistence unit name is not available, a unique @@ -64,7 +68,7 @@ public interface HibernateEntityManagerFactory extends EntityManagerFactory, Ser */ @Deprecated default String getEntityManagerFactoryName() { - return (String) getProperties().get( AvailableSettings.ENTITY_MANAGER_FACTORY_NAME ); + return getSessionFactory().getName(); } /** diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/QueryHints.java b/hibernate-core/src/main/java/org/hibernate/jpa/QueryHints.java index 47c42a7a4f..d380852f35 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/QueryHints.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/QueryHints.java @@ -90,21 +90,33 @@ public class QueryHints { public static final String HINT_NATIVE_LOCKMODE = NATIVE_LOCKMODE; + /** + * @deprecated Use {@link #JAKARTA_HINT_FETCH_GRAPH} instead + */ + @Deprecated + public static final String HINT_FETCHGRAPH = GraphSemantic.FETCH.getJpaHintName(); + /** * Hint providing a "fetchgraph" EntityGraph. Attributes explicitly specified as AttributeNodes are treated as * FetchType.EAGER (via join fetch or subsequent select). - * + * * Note: Currently, attributes that are not specified are treated as FetchType.LAZY or FetchType.EAGER depending * on the attribute's definition in metadata, rather than forcing FetchType.LAZY. */ - public static final String HINT_FETCHGRAPH = GraphSemantic.FETCH.getJpaHintName(); - + public static final String JAKARTA_HINT_FETCH_GRAPH = GraphSemantic.FETCH.getJakartaJpaHintName(); + + /** + * @deprecated Use {@link #JAKARTA_HINT_LOAD_GRAPH} instead + */ + @Deprecated + public static final String HINT_LOADGRAPH = GraphSemantic.LOAD.getJpaHintName(); + /** * Hint providing a "loadgraph" EntityGraph. Attributes explicitly specified as AttributeNodes are treated as * FetchType.EAGER (via join fetch or subsequent select). Attributes that are not specified are treated as * FetchType.LAZY or FetchType.EAGER depending on the attribute's definition in metadata */ - public static final String HINT_LOADGRAPH = GraphSemantic.LOAD.getJpaHintName(); + public static final String JAKARTA_HINT_LOAD_GRAPH = GraphSemantic.LOAD.getJakartaJpaHintName(); /** * Hint providing a "fetchgraph" EntityGraph. Attributes explicitly specified as AttributeNodes are treated as diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java index 7b46bf3632..473b535f6b 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java @@ -50,6 +50,7 @@ import org.hibernate.bytecode.enhance.spi.DefaultEnhancementContext; import org.hibernate.bytecode.enhance.spi.EnhancementContext; import org.hibernate.bytecode.enhance.spi.UnloadedClass; import org.hibernate.bytecode.enhance.spi.UnloadedField; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.cfg.beanvalidation.BeanValidationIntegrator; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; @@ -60,7 +61,6 @@ import org.hibernate.internal.EntityManagerMessageLogger; import org.hibernate.internal.util.NullnessHelper; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.config.ConfigurationHelper; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder; import org.hibernate.jpa.boot.spi.IntegratorProvider; import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; @@ -92,22 +92,25 @@ 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; +import static org.hibernate.cfg.AvailableSettings.COLLECTION_CACHE_PREFIX; import static org.hibernate.cfg.AvailableSettings.DATASOURCE; import static org.hibernate.cfg.AvailableSettings.DRIVER; import static org.hibernate.cfg.AvailableSettings.JACC_CONTEXT_ID; import static org.hibernate.cfg.AvailableSettings.JACC_ENABLED; import static org.hibernate.cfg.AvailableSettings.JACC_PREFIX; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JDBC_DRIVER; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JDBC_PASSWORD; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JDBC_URL; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JDBC_USER; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JTA_DATASOURCE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_NON_JTA_DATASOURCE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_SHARED_CACHE_MODE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_TRANSACTION_TYPE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_VALIDATION_FACTORY; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_VALIDATION_MODE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_DRIVER; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_PASSWORD; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_URL; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_USER; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JTA_DATASOURCE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_NON_JTA_DATASOURCE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_MODE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_TRANSACTION_TYPE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_VALIDATION_FACTORY; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_VALIDATION_MODE; import static org.hibernate.cfg.AvailableSettings.JPA_JDBC_DRIVER; import static org.hibernate.cfg.AvailableSettings.JPA_JDBC_PASSWORD; import static org.hibernate.cfg.AvailableSettings.JPA_JDBC_URL; @@ -119,6 +122,7 @@ import static org.hibernate.cfg.AvailableSettings.JPA_TRANSACTION_TYPE; import static org.hibernate.cfg.AvailableSettings.JPA_VALIDATION_FACTORY; import static org.hibernate.cfg.AvailableSettings.JPA_VALIDATION_MODE; import static org.hibernate.cfg.AvailableSettings.PASS; +import static org.hibernate.cfg.AvailableSettings.PERSISTENCE_UNIT_NAME; import static org.hibernate.cfg.AvailableSettings.SCANNER_DISCOVERY; import static org.hibernate.cfg.AvailableSettings.SESSION_FACTORY_NAME; import static org.hibernate.cfg.AvailableSettings.TC_CLASSLOADER; @@ -127,10 +131,6 @@ import static org.hibernate.cfg.AvailableSettings.URL; import static org.hibernate.cfg.AvailableSettings.USER; import static org.hibernate.internal.HEMLogging.messageLogger; import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER; -import static org.hibernate.jpa.AvailableSettings.CFG_FILE; -import static org.hibernate.jpa.AvailableSettings.CLASS_CACHE_PREFIX; -import static org.hibernate.jpa.AvailableSettings.COLLECTION_CACHE_PREFIX; -import static org.hibernate.jpa.AvailableSettings.PERSISTENCE_UNIT_NAME; /** * @author Steve Ebersole @@ -295,11 +295,11 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil metamodelBuilder.getBootstrapContext() ); - final Object validatorFactory = configurationValues.get( JAKARTA_JPA_VALIDATION_FACTORY ); + final Object validatorFactory = configurationValues.get( JAKARTA_VALIDATION_FACTORY ); if ( validatorFactory == null ) { final Object legacyValidatorFactory = configurationValues.get( JPA_VALIDATION_FACTORY ); if ( legacyValidatorFactory != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_VALIDATION_FACTORY, JAKARTA_JPA_VALIDATION_FACTORY ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_VALIDATION_FACTORY, JAKARTA_VALIDATION_FACTORY ); } withValidatorFactory( legacyValidatorFactory ); } @@ -538,10 +538,10 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil mergedSettings.processPersistenceUnitDescriptorProperties( persistenceUnit ); // see if the persistence.xml settings named a Hibernate config file.... - String cfgXmlResourceName = (String) mergedSettings.configurationValues.remove( CFG_FILE ); + String cfgXmlResourceName = (String) mergedSettings.configurationValues.remove( CFG_XML_FILE ); if ( StringHelper.isEmpty( cfgXmlResourceName ) ) { // see if integration settings named a Hibernate config file.... - cfgXmlResourceName = (String) integrationSettings.get( CFG_FILE ); + cfgXmlResourceName = (String) integrationSettings.get( CFG_XML_FILE ); } if ( StringHelper.isNotEmpty( cfgXmlResourceName ) ) { @@ -629,31 +629,31 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil // normalize ValidationMode final Object intgValidationMode = integrationSettingsCopy.remove( JPA_VALIDATION_MODE ); - final Object jakartaIntgValidationMode = integrationSettingsCopy.remove( JAKARTA_JPA_VALIDATION_MODE ); + final Object jakartaIntgValidationMode = integrationSettingsCopy.remove( JAKARTA_VALIDATION_MODE ); if ( jakartaIntgValidationMode != null ) { - mergedSettings.configurationValues.put( JAKARTA_JPA_VALIDATION_MODE, jakartaIntgValidationMode ); + mergedSettings.configurationValues.put( JAKARTA_VALIDATION_MODE, jakartaIntgValidationMode ); } else if ( intgValidationMode != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_VALIDATION_MODE, JAKARTA_JPA_VALIDATION_MODE ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_VALIDATION_MODE, JAKARTA_VALIDATION_MODE ); mergedSettings.configurationValues.put( JPA_VALIDATION_MODE, intgValidationMode ); } else if ( persistenceUnit.getValidationMode() != null ) { mergedSettings.configurationValues.put( JPA_VALIDATION_MODE, persistenceUnit.getValidationMode() ); - mergedSettings.configurationValues.put( JAKARTA_JPA_VALIDATION_MODE, persistenceUnit.getValidationMode() ); + mergedSettings.configurationValues.put( JAKARTA_VALIDATION_MODE, persistenceUnit.getValidationMode() ); } // normalize SharedCacheMode final Object intgCacheMode = integrationSettingsCopy.remove( JPA_SHARED_CACHE_MODE ); - final Object jakartaIntgCacheMode = integrationSettingsCopy.remove( JAKARTA_JPA_SHARED_CACHE_MODE ); + final Object jakartaIntgCacheMode = integrationSettingsCopy.remove( JAKARTA_SHARED_CACHE_MODE ); if ( jakartaIntgCacheMode != null ) { - mergedSettings.configurationValues.put( JAKARTA_JPA_SHARED_CACHE_MODE, jakartaIntgCacheMode ); + mergedSettings.configurationValues.put( JAKARTA_SHARED_CACHE_MODE, jakartaIntgCacheMode ); } else if ( intgCacheMode != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_SHARED_CACHE_MODE, JAKARTA_JPA_SHARED_CACHE_MODE ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_SHARED_CACHE_MODE, JAKARTA_SHARED_CACHE_MODE ); mergedSettings.configurationValues.put( JPA_SHARED_CACHE_MODE, intgCacheMode ); } else if ( persistenceUnit.getSharedCacheMode() != null ) { - mergedSettings.configurationValues.put( JAKARTA_JPA_SHARED_CACHE_MODE, persistenceUnit.getSharedCacheMode() ); + mergedSettings.configurationValues.put( JAKARTA_SHARED_CACHE_MODE, persistenceUnit.getSharedCacheMode() ); mergedSettings.configurationValues.put( JPA_SHARED_CACHE_MODE, persistenceUnit.getSharedCacheMode() ); } @@ -685,20 +685,20 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil MergedSettings mergedSettings) { final Object effectiveUser = NullnessHelper.coalesceSuppliedValues( () -> integrationSettingsCopy.remove( USER ), - () -> integrationSettingsCopy.remove( JAKARTA_JPA_JDBC_USER ), + () -> integrationSettingsCopy.remove( JAKARTA_JDBC_USER ), () -> { final Object setting = integrationSettingsCopy.remove( JPA_JDBC_USER ); if ( setting != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_USER, JAKARTA_JPA_JDBC_USER ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_USER, JAKARTA_JDBC_USER ); } return setting; }, () -> extractPuProperty( persistenceUnit, USER ), - () -> extractPuProperty( persistenceUnit, JAKARTA_JPA_JDBC_USER ), + () -> extractPuProperty( persistenceUnit, JAKARTA_JDBC_USER ), () -> { final Object setting = extractPuProperty( persistenceUnit, JPA_JDBC_USER ); if ( setting != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_USER, JAKARTA_JPA_JDBC_USER ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_USER, JAKARTA_JDBC_USER ); } return setting; } @@ -706,21 +706,21 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil final Object effectivePass = NullnessHelper.coalesceSuppliedValues( () -> integrationSettingsCopy.remove( PASS ), - () -> integrationSettingsCopy.remove( JAKARTA_JPA_JDBC_PASSWORD ), + () -> integrationSettingsCopy.remove( JAKARTA_JDBC_PASSWORD ), () -> { final Object setting = integrationSettingsCopy.remove( JPA_JDBC_PASSWORD ); if ( setting != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_PASSWORD, JAKARTA_JPA_JDBC_PASSWORD ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_PASSWORD, JAKARTA_JDBC_PASSWORD ); } return setting; }, () -> extractPuProperty( persistenceUnit, PASS ), - () -> extractPuProperty( persistenceUnit, JAKARTA_JPA_JDBC_PASSWORD ), + () -> extractPuProperty( persistenceUnit, JAKARTA_JDBC_PASSWORD ), () -> { { final Object setting = extractPuProperty( persistenceUnit, JPA_JDBC_PASSWORD ); if ( setting != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_PASSWORD, JAKARTA_JPA_JDBC_PASSWORD ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_PASSWORD, JAKARTA_JDBC_PASSWORD ); } return setting; } @@ -741,13 +741,13 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil private void applyUserAndPass(Object effectiveUser, Object effectivePass, MergedSettings mergedSettings) { if ( effectiveUser != null ) { mergedSettings.configurationValues.put( USER, effectiveUser ); - mergedSettings.configurationValues.put( JAKARTA_JPA_JDBC_USER, effectiveUser ); + mergedSettings.configurationValues.put( JAKARTA_JDBC_USER, effectiveUser ); mergedSettings.configurationValues.put( JPA_JDBC_USER, effectiveUser ); } if ( effectivePass != null ) { mergedSettings.configurationValues.put( PASS, effectivePass ); - mergedSettings.configurationValues.put( JAKARTA_JPA_JDBC_PASSWORD, effectivePass ); + mergedSettings.configurationValues.put( JAKARTA_JDBC_PASSWORD, effectivePass ); mergedSettings.configurationValues.put( JPA_JDBC_PASSWORD, effectivePass ); } } @@ -761,11 +761,11 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil MergedSettings mergedSettings) { PersistenceUnitTransactionType txnType = null; - Object intgTxnType = integrationSettingsCopy.remove( JAKARTA_JPA_TRANSACTION_TYPE ); + Object intgTxnType = integrationSettingsCopy.remove( JAKARTA_TRANSACTION_TYPE ); if ( intgTxnType == null ) { intgTxnType = integrationSettingsCopy.remove( JPA_TRANSACTION_TYPE ); if ( intgTxnType != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_TRANSACTION_TYPE, JAKARTA_JPA_TRANSACTION_TYPE ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_TRANSACTION_TYPE, JAKARTA_TRANSACTION_TYPE ); } } @@ -776,11 +776,11 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil txnType = persistenceUnit.getTransactionType(); } else { - Object puPropTxnType = mergedSettings.configurationValues.get( JAKARTA_JPA_TRANSACTION_TYPE ); + Object puPropTxnType = mergedSettings.configurationValues.get( JAKARTA_TRANSACTION_TYPE ); if ( puPropTxnType == null ) { puPropTxnType = mergedSettings.configurationValues.get( JPA_TRANSACTION_TYPE ); if ( puPropTxnType != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_TRANSACTION_TYPE, JAKARTA_JPA_TRANSACTION_TYPE ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_TRANSACTION_TYPE, JAKARTA_TRANSACTION_TYPE ); } } @@ -859,8 +859,8 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } } - if ( integrationSettingsCopy.containsKey( JAKARTA_JPA_JTA_DATASOURCE ) ) { - final Object dataSourceRef = integrationSettingsCopy.remove( JAKARTA_JPA_JTA_DATASOURCE ); + if ( integrationSettingsCopy.containsKey( JAKARTA_JTA_DATASOURCE ) ) { + final Object dataSourceRef = integrationSettingsCopy.remove( JAKARTA_JTA_DATASOURCE ); if ( dataSourceRef != null ) { applyDataSource( dataSourceRef, @@ -875,7 +875,7 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } if ( integrationSettingsCopy.containsKey( JPA_JTA_DATASOURCE ) ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JTA_DATASOURCE, JAKARTA_JPA_JTA_DATASOURCE ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JTA_DATASOURCE, JAKARTA_JTA_DATASOURCE ); final Object dataSourceRef = integrationSettingsCopy.remove( JPA_JTA_DATASOURCE ); if ( dataSourceRef != null ) { applyDataSource( dataSourceRef, true,integrationSettingsCopy, mergedSettings ); @@ -885,8 +885,8 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } } - if ( integrationSettingsCopy.containsKey( JAKARTA_JPA_NON_JTA_DATASOURCE ) ) { - final Object dataSourceRef = integrationSettingsCopy.remove( JAKARTA_JPA_NON_JTA_DATASOURCE ); + if ( integrationSettingsCopy.containsKey( JAKARTA_NON_JTA_DATASOURCE ) ) { + final Object dataSourceRef = integrationSettingsCopy.remove( JAKARTA_NON_JTA_DATASOURCE ); applyDataSource( dataSourceRef, false, integrationSettingsCopy, mergedSettings ); // EARLY EXIT!! @@ -894,7 +894,7 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } if ( integrationSettingsCopy.containsKey( JPA_NON_JTA_DATASOURCE ) ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_NON_JTA_DATASOURCE, JAKARTA_JPA_NON_JTA_DATASOURCE ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_NON_JTA_DATASOURCE, JAKARTA_NON_JTA_DATASOURCE ); final Object dataSourceRef = integrationSettingsCopy.remove( JPA_NON_JTA_DATASOURCE ); applyDataSource( dataSourceRef, false, integrationSettingsCopy, mergedSettings ); @@ -912,20 +912,20 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil integrationJdbcUrl, NullnessHelper.coalesceSuppliedValues( () -> ConfigurationHelper.getString( DRIVER, integrationSettingsCopy ), - () -> ConfigurationHelper.getString( JAKARTA_JPA_JDBC_DRIVER, integrationSettingsCopy ), + () -> ConfigurationHelper.getString( JAKARTA_JDBC_DRIVER, integrationSettingsCopy ), () -> { final String driver = ConfigurationHelper.getString( JPA_JDBC_DRIVER, integrationSettingsCopy ); if ( driver != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JPA_JDBC_DRIVER ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JDBC_DRIVER ); } return driver; }, () -> ConfigurationHelper.getString( DRIVER, mergedSettings.configurationValues ), - () -> ConfigurationHelper.getString( JAKARTA_JPA_JDBC_DRIVER, mergedSettings.configurationValues ), + () -> ConfigurationHelper.getString( JAKARTA_JDBC_DRIVER, mergedSettings.configurationValues ), () -> { final String driver = ConfigurationHelper.getString( JPA_JDBC_DRIVER, mergedSettings.configurationValues ); if ( driver != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JPA_JDBC_DRIVER ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JDBC_DRIVER ); } return driver; } @@ -939,16 +939,16 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } } - if ( integrationSettingsCopy.containsKey( JAKARTA_JPA_JDBC_URL ) ) { - final Object integrationJdbcUrl = integrationSettingsCopy.get( JAKARTA_JPA_JDBC_URL ); + if ( integrationSettingsCopy.containsKey( JAKARTA_JDBC_URL ) ) { + final Object integrationJdbcUrl = integrationSettingsCopy.get( JAKARTA_JDBC_URL ); if ( integrationJdbcUrl != null ) { //noinspection unchecked applyJdbcSettings( integrationJdbcUrl, NullnessHelper.coalesceSuppliedValues( - () -> ConfigurationHelper.getString( JAKARTA_JPA_JDBC_DRIVER, integrationSettingsCopy ), - () -> ConfigurationHelper.getString( JAKARTA_JPA_JDBC_DRIVER, mergedSettings.configurationValues ) + () -> ConfigurationHelper.getString( JAKARTA_JDBC_DRIVER, integrationSettingsCopy ), + () -> ConfigurationHelper.getString( JAKARTA_JDBC_DRIVER, mergedSettings.configurationValues ) ), integrationSettingsCopy, mergedSettings @@ -960,7 +960,7 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } if ( integrationSettingsCopy.containsKey( JPA_JDBC_URL ) ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_URL, JAKARTA_JPA_JDBC_URL ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_URL, JAKARTA_JDBC_URL ); final Object integrationJdbcUrl = integrationSettingsCopy.get( JPA_JDBC_URL ); @@ -972,14 +972,14 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil () -> { final String driver = ConfigurationHelper.getString( JPA_JDBC_DRIVER, integrationSettingsCopy ); if ( driver != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JPA_JDBC_DRIVER ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JDBC_DRIVER ); } return driver; }, () -> { final String driver = ConfigurationHelper.getString( JPA_JDBC_DRIVER, mergedSettings.configurationValues ); if ( driver != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JPA_JDBC_DRIVER ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JDBC_DRIVER ); } return driver; } @@ -1023,13 +1023,13 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } } - if ( mergedSettings.configurationValues.containsKey( JAKARTA_JPA_JDBC_URL ) ) { - final Object url = mergedSettings.configurationValues.get( JAKARTA_JPA_JDBC_URL ); + if ( mergedSettings.configurationValues.containsKey( JAKARTA_JDBC_URL ) ) { + final Object url = mergedSettings.configurationValues.get( JAKARTA_JDBC_URL ); if ( url != null && ( ! ( url instanceof String ) || StringHelper.isNotEmpty( (String) url ) ) ) { applyJdbcSettings( url, - ConfigurationHelper.getString( JAKARTA_JPA_JDBC_DRIVER, mergedSettings.configurationValues ), + ConfigurationHelper.getString( JAKARTA_JDBC_DRIVER, mergedSettings.configurationValues ), integrationSettingsCopy, mergedSettings ); @@ -1040,14 +1040,14 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } if ( mergedSettings.configurationValues.containsKey( JPA_JDBC_URL ) ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_URL, JAKARTA_JPA_JDBC_URL ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_URL, JAKARTA_JDBC_URL ); final Object url = mergedSettings.configurationValues.get( JPA_JDBC_URL ); if ( url != null && ( ! ( url instanceof String ) || StringHelper.isNotEmpty( (String) url ) ) ) { final String driver = ConfigurationHelper.getString( JPA_JDBC_DRIVER, mergedSettings.configurationValues ); if ( driver != null ) { - DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JPA_JDBC_DRIVER ); + DEPRECATION_LOGGER.deprecatedSetting( JPA_JDBC_DRIVER, JAKARTA_JDBC_DRIVER ); } applyJdbcSettings( url, driver, integrationSettingsCopy, mergedSettings ); @@ -1081,15 +1081,15 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil final String jakartaInverseEmfKey; if ( isJta ) { emfKey = JPA_JTA_DATASOURCE; - jakartaEmfKey = JAKARTA_JPA_JTA_DATASOURCE; + jakartaEmfKey = JAKARTA_JTA_DATASOURCE; inverseEmfKey = JPA_NON_JTA_DATASOURCE; - jakartaInverseEmfKey = JAKARTA_JPA_NON_JTA_DATASOURCE; + jakartaInverseEmfKey = JAKARTA_NON_JTA_DATASOURCE; } else { emfKey = JPA_NON_JTA_DATASOURCE; - jakartaEmfKey = JAKARTA_JPA_NON_JTA_DATASOURCE; + jakartaEmfKey = JAKARTA_NON_JTA_DATASOURCE; inverseEmfKey = JPA_JTA_DATASOURCE; - jakartaInverseEmfKey = JAKARTA_JPA_JTA_DATASOURCE; + jakartaInverseEmfKey = JAKARTA_JTA_DATASOURCE; } mergedSettings.configurationValues.put( emfKey, dataSourceRef ); mergedSettings.configurationValues.put( jakartaEmfKey, dataSourceRef ); @@ -1101,10 +1101,10 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil inverseEmfKey, jakartaInverseEmfKey, JPA_JDBC_DRIVER, - JAKARTA_JPA_JDBC_DRIVER, + JAKARTA_JDBC_DRIVER, DRIVER, JPA_JDBC_URL, - JAKARTA_JPA_JDBC_URL, + JAKARTA_JDBC_URL, URL ); @@ -1115,9 +1115,9 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil integrationSettingsCopy, DATASOURCE, JPA_JTA_DATASOURCE, - JAKARTA_JPA_JTA_DATASOURCE, + JAKARTA_JTA_DATASOURCE, JPA_NON_JTA_DATASOURCE, - JAKARTA_JPA_NON_JTA_DATASOURCE + JAKARTA_NON_JTA_DATASOURCE ); // add under Hibernate's DATASOURCE setting where the ConnectionProvider will find it @@ -1152,17 +1152,17 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil MergedSettings mergedSettings) { mergedSettings.configurationValues.put( URL, url ); mergedSettings.configurationValues.put( JPA_JDBC_URL, url ); - mergedSettings.configurationValues.put( JAKARTA_JPA_JDBC_URL, url ); + mergedSettings.configurationValues.put( JAKARTA_JDBC_URL, url ); if ( driver != null ) { mergedSettings.configurationValues.put( DRIVER, driver ); mergedSettings.configurationValues.put( JPA_JDBC_DRIVER, driver ); - mergedSettings.configurationValues.put( JAKARTA_JPA_JDBC_DRIVER, driver ); + mergedSettings.configurationValues.put( JAKARTA_JDBC_DRIVER, driver ); } else { mergedSettings.configurationValues.remove( DRIVER ); mergedSettings.configurationValues.remove( JPA_JDBC_DRIVER ); - mergedSettings.configurationValues.remove( JAKARTA_JPA_JDBC_DRIVER ); + mergedSettings.configurationValues.remove( JAKARTA_JDBC_DRIVER ); } // clean up the integration-map values @@ -1170,16 +1170,16 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil integrationSettingsCopy, DRIVER, JPA_JDBC_DRIVER, - JAKARTA_JPA_JDBC_DRIVER, + JAKARTA_JDBC_DRIVER, URL, JPA_JDBC_URL, - JAKARTA_JPA_JDBC_URL, + JAKARTA_JDBC_URL, USER, JPA_JDBC_USER, - JAKARTA_JPA_JDBC_USER, + JAKARTA_JDBC_USER, PASS, JPA_JDBC_PASSWORD, - JAKARTA_JPA_JDBC_PASSWORD + JAKARTA_JDBC_PASSWORD ); cleanUpConfigKeys( @@ -1187,9 +1187,9 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil mergedSettings, DATASOURCE, JPA_JTA_DATASOURCE, - JAKARTA_JPA_JTA_DATASOURCE, + JAKARTA_JTA_DATASOURCE, JPA_NON_JTA_DATASOURCE, - JAKARTA_JPA_NON_JTA_DATASOURCE + JAKARTA_NON_JTA_DATASOURCE ); } @@ -1326,7 +1326,7 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil List converterDescriptors = null; // add any explicit Class references passed in - final List loadedAnnotatedClasses = (List) configurationValues.remove( AvailableSettings.LOADED_CLASSES ); + final List loadedAnnotatedClasses = (List) configurationValues.remove( org.hibernate.cfg.AvailableSettings.LOADED_CLASSES ); if ( loadedAnnotatedClasses != null ) { for ( Class cls : loadedAnnotatedClasses ) { if ( AttributeConverter.class.isAssignableFrom( cls ) ) { @@ -1344,7 +1344,7 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } // add any explicit hbm.xml references passed in - final String explicitHbmXmls = (String) configurationValues.remove( AvailableSettings.HBXML_FILES ); + final String explicitHbmXmls = (String) configurationValues.remove( org.hibernate.cfg.AvailableSettings.HBM_XML_FILES ); if ( explicitHbmXmls != null ) { for ( String hbmXml : StringHelper.split( ", ", explicitHbmXmls ) ) { metadataSources.addResource( hbmXml ); @@ -1352,7 +1352,7 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil } // add any explicit orm.xml references passed in - final List explicitOrmXmlList = (List) configurationValues.remove( AvailableSettings.XML_FILE_NAMES ); + final List explicitOrmXmlList = (List) configurationValues.remove( org.hibernate.cfg.AvailableSettings.ORM_XML_FILES ); if ( explicitOrmXmlList != null ) { explicitOrmXmlList.forEach( metadataSources::addResource ); } diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java b/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java index c94b403421..ecb1495c88 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java @@ -267,51 +267,50 @@ public class PersistenceXmlParser { // per JPA spec, any settings passed in to PersistenceProvider bootstrap methods should override // values found in persistence.xml - - if ( integration.containsKey( AvailableSettings.JPA_PERSISTENCE_PROVIDER ) ) { + if ( integration.containsKey( AvailableSettings.JAKARTA_PERSISTENCE_PROVIDER ) ) { + persistenceUnit.setProviderClassName( (String) integration.get( AvailableSettings.JAKARTA_PERSISTENCE_PROVIDER ) ); + } + else if ( integration.containsKey( AvailableSettings.JPA_PERSISTENCE_PROVIDER ) ) { DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( AvailableSettings.JPA_PERSISTENCE_PROVIDER, - AvailableSettings.JAKARTA_JPA_PERSISTENCE_PROVIDER + AvailableSettings.JAKARTA_PERSISTENCE_PROVIDER ); persistenceUnit.setProviderClassName( (String) integration.get( AvailableSettings.JPA_PERSISTENCE_PROVIDER ) ); } - else if ( integration.containsKey( AvailableSettings.JAKARTA_JPA_PERSISTENCE_PROVIDER ) ) { - persistenceUnit.setProviderClassName( (String) integration.get( AvailableSettings.JAKARTA_JPA_PERSISTENCE_PROVIDER ) ); - } if ( integration.containsKey( AvailableSettings.JPA_TRANSACTION_TYPE ) ) { DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( AvailableSettings.JPA_TRANSACTION_TYPE, - AvailableSettings.JAKARTA_JPA_TRANSACTION_TYPE + AvailableSettings.JAKARTA_TRANSACTION_TYPE ); String transactionType = (String) integration.get( AvailableSettings.JPA_TRANSACTION_TYPE ); persistenceUnit.setTransactionType( parseTransactionType( transactionType ) ); } - else if ( integration.containsKey( AvailableSettings.JAKARTA_JPA_TRANSACTION_TYPE ) ) { - String transactionType = (String) integration.get( AvailableSettings.JAKARTA_JPA_TRANSACTION_TYPE ); + else if ( integration.containsKey( AvailableSettings.JAKARTA_TRANSACTION_TYPE ) ) { + String transactionType = (String) integration.get( AvailableSettings.JAKARTA_TRANSACTION_TYPE ); persistenceUnit.setTransactionType( parseTransactionType( transactionType ) ); } if ( integration.containsKey( AvailableSettings.JPA_JTA_DATASOURCE ) ) { DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( AvailableSettings.JPA_JTA_DATASOURCE, - AvailableSettings.JAKARTA_JPA_JTA_DATASOURCE + AvailableSettings.JAKARTA_JTA_DATASOURCE ); persistenceUnit.setJtaDataSource( integration.get( AvailableSettings.JPA_JTA_DATASOURCE ) ); } - else if ( integration.containsKey( AvailableSettings.JAKARTA_JPA_JTA_DATASOURCE ) ) { - persistenceUnit.setJtaDataSource( integration.get( AvailableSettings.JAKARTA_JPA_JTA_DATASOURCE ) ); + else if ( integration.containsKey( AvailableSettings.JAKARTA_JTA_DATASOURCE ) ) { + persistenceUnit.setJtaDataSource( integration.get( AvailableSettings.JAKARTA_JTA_DATASOURCE ) ); } if ( integration.containsKey( AvailableSettings.JPA_NON_JTA_DATASOURCE ) ) { DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( AvailableSettings.JPA_NON_JTA_DATASOURCE, - AvailableSettings.JAKARTA_JPA_NON_JTA_DATASOURCE + AvailableSettings.JAKARTA_NON_JTA_DATASOURCE ); persistenceUnit.setNonJtaDataSource( integration.get( AvailableSettings.JPA_NON_JTA_DATASOURCE ) ); } - else if ( integration.containsKey( AvailableSettings.JAKARTA_JPA_NON_JTA_DATASOURCE ) ) { - persistenceUnit.setNonJtaDataSource( integration.get( AvailableSettings.JAKARTA_JPA_NON_JTA_DATASOURCE ) ); + else if ( integration.containsKey( AvailableSettings.JAKARTA_NON_JTA_DATASOURCE ) ) { + persistenceUnit.setNonJtaDataSource( integration.get( AvailableSettings.JAKARTA_NON_JTA_DATASOURCE ) ); } decodeTransactionType( persistenceUnit ); diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/boot/spi/ProviderChecker.java b/hibernate-core/src/main/java/org/hibernate/jpa/boot/spi/ProviderChecker.java index d76cf2cf2f..eb19afc962 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/boot/spi/ProviderChecker.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/boot/spi/ProviderChecker.java @@ -11,6 +11,7 @@ import java.util.Map; import org.hibernate.cfg.AvailableSettings; import org.hibernate.internal.HEMLogging; import org.hibernate.internal.log.DeprecationLogger; +import org.hibernate.internal.util.NullnessHelper; import org.hibernate.jpa.HibernatePersistenceProvider; import org.jboss.logging.Logger; @@ -103,16 +104,21 @@ public final class ProviderChecker { if ( integration == null ) { return null; } - String setting = (String) integration.get(AvailableSettings.JPA_PERSISTENCE_PROVIDER); - if ( setting == null ) { - setting = (String) integration.get(AvailableSettings.JAKARTA_JPA_PERSISTENCE_PROVIDER); - } - else { - DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( - AvailableSettings.JPA_PERSISTENCE_PROVIDER, - AvailableSettings.JAKARTA_JPA_PERSISTENCE_PROVIDER - ); - } + + final String setting = NullnessHelper.coalesceSuppliedValues( + () -> (String) integration.get(AvailableSettings.JAKARTA_PERSISTENCE_PROVIDER ), + () -> { + final String value = (String) integration.get( AvailableSettings.JPA_PERSISTENCE_PROVIDER ); + if ( value != null ) { + DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( + AvailableSettings.JPA_PERSISTENCE_PROVIDER, + AvailableSettings.JAKARTA_PERSISTENCE_PROVIDER + ); + } + return value; + } + ); + return setting == null ? null : setting.trim(); } diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/internal/util/LockOptionsHelper.java b/hibernate-core/src/main/java/org/hibernate/jpa/internal/util/LockOptionsHelper.java index d6b911f617..33b2ede8b6 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/internal/util/LockOptionsHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/internal/util/LockOptionsHelper.java @@ -13,8 +13,8 @@ import jakarta.persistence.PessimisticLockScope; import org.hibernate.LockOptions; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_LOCK_SCOPE; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_LOCK_TIMEOUT; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_SCOPE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_TIMEOUT; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_SCOPE; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_TIMEOUT; @@ -36,7 +36,7 @@ public final class LockOptionsHelper { String lockScopeHint = JPA_LOCK_SCOPE; Object lockScope = props.get( lockScopeHint ); if ( lockScope == null ) { - lockScopeHint = JAKARTA_JPA_LOCK_SCOPE; + lockScopeHint = JAKARTA_LOCK_SCOPE; lockScope = props.get( lockScopeHint ); } if ( lockScope instanceof String && PessimisticLockScope.valueOf( (String) lockScope ) == PessimisticLockScope.EXTENDED ) { @@ -53,7 +53,7 @@ public final class LockOptionsHelper { String timeoutHint = JPA_LOCK_TIMEOUT; Object lockTimeout = props.get( timeoutHint ); if (lockTimeout == null) { - timeoutHint = JAKARTA_JPA_LOCK_TIMEOUT; + timeoutHint = JAKARTA_LOCK_TIMEOUT; lockTimeout = props.get( timeoutHint ); } int timeout = 0; diff --git a/hibernate-core/src/main/java/org/hibernate/query/spi/AbstractQuery.java b/hibernate-core/src/main/java/org/hibernate/query/spi/AbstractQuery.java index 39926fcbcd..f9594752cd 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/spi/AbstractQuery.java +++ b/hibernate-core/src/main/java/org/hibernate/query/spi/AbstractQuery.java @@ -46,6 +46,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.graph.spi.RootGraphImplementor; import org.hibernate.internal.EntityManagerMessageLogger; import org.hibernate.internal.HEMLogging; +import org.hibernate.internal.log.DeprecationLogger; import org.hibernate.jpa.QueryHints; import org.hibernate.jpa.internal.util.CacheModeHelper; import org.hibernate.jpa.internal.util.ConfigurationHelper; @@ -72,12 +73,17 @@ import static org.hibernate.LockMode.UPGRADE; import static org.hibernate.LockOptions.NONE; import static org.hibernate.LockOptions.READ; import static org.hibernate.LockOptions.WAIT_FOREVER; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_SCOPE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_TIMEOUT; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_RETRIEVE_MODE; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_STORE_MODE; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_SCOPE; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_TIMEOUT; import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_RETRIEVE_MODE; import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_STORE_MODE; +import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER; import static org.hibernate.internal.util.NullnessHelper.nullif; -import static org.hibernate.jpa.AvailableSettings.ALIAS_SPECIFIC_LOCK_MODE; +import static org.hibernate.annotations.QueryHints.NATIVE_LOCKMODE; import static org.hibernate.jpa.QueryHints.HINT_CACHEABLE; import static org.hibernate.jpa.QueryHints.HINT_CACHE_MODE; import static org.hibernate.jpa.QueryHints.HINT_CACHE_REGION; @@ -90,6 +96,8 @@ import static org.hibernate.jpa.QueryHints.HINT_LOADGRAPH; import static org.hibernate.jpa.QueryHints.HINT_NATIVE_SPACES; import static org.hibernate.jpa.QueryHints.HINT_READONLY; import static org.hibernate.jpa.QueryHints.HINT_TIMEOUT; +import static org.hibernate.jpa.QueryHints.JAKARTA_HINT_FETCH_GRAPH; +import static org.hibernate.jpa.QueryHints.JAKARTA_HINT_LOAD_GRAPH; import static org.hibernate.jpa.QueryHints.SPEC_HINT_TIMEOUT; /** @@ -387,16 +395,18 @@ public abstract class AbstractQuery implements QueryImplementor { if ( getLockOptions().getTimeOut() != WAIT_FOREVER ) { hints.put( JPA_LOCK_TIMEOUT, getLockOptions().getTimeOut() ); + hints.put( JAKARTA_LOCK_TIMEOUT, getLockOptions().getTimeOut() ); } if ( getLockOptions().getScope() ) { hints.put( JPA_LOCK_SCOPE, getLockOptions().getScope() ); + hints.put( JAKARTA_LOCK_SCOPE, getLockOptions().getScope() ); } if ( getLockOptions().hasAliasSpecificLockModes() ) { for ( Map.Entry entry : getLockOptions().getAliasSpecificLocks() ) { hints.put( - ALIAS_SPECIFIC_LOCK_MODE + '.' + entry.getKey(), + NATIVE_LOCKMODE + '.' + entry.getKey(), entry.getValue().name() ); } @@ -408,6 +418,8 @@ public abstract class AbstractQuery implements QueryImplementor { if ( getCacheMode() != null ) { putIfNotNull( hints, HINT_CACHE_MODE, getCacheMode() ); + putIfNotNull( hints, JAKARTA_SHARED_CACHE_RETRIEVE_MODE, CacheModeHelper.interpretCacheRetrieveMode( getCacheMode() ) ); + putIfNotNull( hints, JAKARTA_SHARED_CACHE_STORE_MODE, CacheModeHelper.interpretCacheStoreMode( getCacheMode() ) ); putIfNotNull( hints, JPA_SHARED_CACHE_RETRIEVE_MODE, CacheModeHelper.interpretCacheRetrieveMode( getCacheMode() ) ); putIfNotNull( hints, JPA_SHARED_CACHE_STORE_MODE, CacheModeHelper.interpretCacheStoreMode( getCacheMode() ) ); } @@ -475,6 +487,14 @@ public abstract class AbstractQuery implements QueryImplementor { else if ( HINT_CACHE_MODE.equals( hintName ) ) { applied = applyCacheModeHint( ConfigurationHelper.getCacheMode( value ) ); } + else if ( JAKARTA_SHARED_CACHE_RETRIEVE_MODE.equals( hintName ) ) { + final CacheRetrieveMode retrieveMode = value != null ? CacheRetrieveMode.valueOf( value.toString() ) : null; + applied = applyJpaCacheRetrieveMode( retrieveMode ); + } + else if ( JAKARTA_SHARED_CACHE_STORE_MODE.equals( hintName ) ) { + final CacheStoreMode storeMode = value != null ? CacheStoreMode.valueOf( value.toString() ) : null; + applied = applyJpaCacheStoreMode( storeMode ); + } else if ( JPA_SHARED_CACHE_RETRIEVE_MODE.equals( hintName ) ) { final CacheRetrieveMode retrieveMode = value != null ? CacheRetrieveMode.valueOf( value.toString() ) : null; applied = applyJpaCacheRetrieveMode( retrieveMode ); @@ -486,9 +506,9 @@ public abstract class AbstractQuery implements QueryImplementor { else if ( QueryHints.HINT_NATIVE_LOCKMODE.equals( hintName ) ) { applied = applyNativeQueryLockMode( value ); } - else if ( hintName.startsWith( ALIAS_SPECIFIC_LOCK_MODE ) ) { + else if ( hintName.startsWith( NATIVE_LOCKMODE ) ) { // extract the alias - final String alias = hintName.substring( ALIAS_SPECIFIC_LOCK_MODE.length() + 1 ); + final String alias = hintName.substring( NATIVE_LOCKMODE.length() + 1 ); // determine the LockMode try { final LockMode lockMode = LockModeTypeHelper.interpretLockMode( value ); @@ -500,15 +520,38 @@ public abstract class AbstractQuery implements QueryImplementor { applied = false; } } - else if ( HINT_FETCHGRAPH.equals( hintName ) || HINT_LOADGRAPH.equals( hintName ) ) { - if (value instanceof RootGraphImplementor ) { + else if ( JAKARTA_HINT_FETCH_GRAPH.equals( hintName ) || JAKARTA_HINT_LOAD_GRAPH.equals( hintName ) ) { + if ( value instanceof RootGraphImplementor ) { applyEntityGraphQueryHint( hintName, (RootGraphImplementor) value ); } else { + // https://hibernate.atlassian.net/browse/HHH-14855 - accepting a String parseable + // via the Graph Language parser here would be a nice feature log.warnf( "The %s hint was set, but the value was not an EntityGraph!", hintName ); } applied = true; } + else if ( HINT_FETCHGRAPH.equals( hintName ) || HINT_LOADGRAPH.equals( hintName ) ) { + if ( HINT_FETCHGRAPH.equals( hintName ) ) { + DEPRECATION_LOGGER.deprecatedSetting( HINT_FETCHGRAPH, JAKARTA_HINT_FETCH_GRAPH ); + } + else { + assert HINT_LOADGRAPH.equals( hintName ); + DEPRECATION_LOGGER.deprecatedSetting( HINT_FETCHGRAPH, JAKARTA_HINT_FETCH_GRAPH ); + } + + if ( value instanceof RootGraphImplementor ) { + applyEntityGraphQueryHint( hintName, (RootGraphImplementor) value ); + } + else { + // https://hibernate.atlassian.net/browse/HHH-14855 - accepting a String parseable + // via the Graph Language parser here would be a nice feature + log.warnf( "The %s hint was set, but the value was not an EntityGraph!", hintName ); + } + applied = true; + } + + else if ( HINT_FOLLOW_ON_LOCKING.equals( hintName ) ) { applied = applyFollowOnLockingHint( ConfigurationHelper.getBoolean( value ) ); } diff --git a/hibernate-core/src/main/java/org/hibernate/resource/beans/container/internal/CdiBeanContainerBuilder.java b/hibernate-core/src/main/java/org/hibernate/resource/beans/container/internal/CdiBeanContainerBuilder.java index 7188ef73df..f32de1409c 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/beans/container/internal/CdiBeanContainerBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/beans/container/internal/CdiBeanContainerBuilder.java @@ -15,7 +15,7 @@ import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; import org.hibernate.engine.config.spi.ConfigurationService; import org.hibernate.engine.config.spi.StandardConverters; import org.hibernate.internal.util.ReflectHelper; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.resource.beans.container.spi.BeanContainer; import org.hibernate.resource.beans.spi.ManagedBeanRegistryInitiator; import org.hibernate.service.ServiceRegistry; diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/HibernateSchemaManagementTool.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/HibernateSchemaManagementTool.java index 67760015a9..09292c5f30 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/HibernateSchemaManagementTool.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/HibernateSchemaManagementTool.java @@ -57,10 +57,10 @@ 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_VERSION; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_CONNECTION; import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_DB_MAJOR_VERSION; import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_DB_MINOR_VERSION; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_DB_VERSION; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_CONNECTION; import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_DB_NAME; import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER; import static org.hibernate.internal.util.NullnessHelper.coalesceSuppliedValues; diff --git a/hibernate-core/src/test/bundles/templates/cfgxmlpar/META-INF/persistence.xml b/hibernate-core/src/test/bundles/templates/cfgxmlpar/META-INF/persistence.xml index 98f2b4e2cb..c04ccbb9d3 100644 --- a/hibernate-core/src/test/bundles/templates/cfgxmlpar/META-INF/persistence.xml +++ b/hibernate-core/src/test/bundles/templates/cfgxmlpar/META-INF/persistence.xml @@ -14,7 +14,7 @@ org.hibernate.jpa.HibernatePersistenceProvider - + diff --git a/hibernate-core/src/test/bundles/templates/explicitpar/META-INF/persistence.xml b/hibernate-core/src/test/bundles/templates/explicitpar/META-INF/persistence.xml index 855f1ef02b..9164d45672 100644 --- a/hibernate-core/src/test/bundles/templates/explicitpar/META-INF/persistence.xml +++ b/hibernate-core/src/test/bundles/templates/explicitpar/META-INF/persistence.xml @@ -18,7 +18,7 @@ true - + @@ -35,20 +35,14 @@ - - - - + - - - - - + diff --git a/hibernate-core/src/test/bundles/templates/explicitpar2/META-INF/persistence.xml b/hibernate-core/src/test/bundles/templates/explicitpar2/META-INF/persistence.xml index a27db917b7..f72527911d 100644 --- a/hibernate-core/src/test/bundles/templates/explicitpar2/META-INF/persistence.xml +++ b/hibernate-core/src/test/bundles/templates/explicitpar2/META-INF/persistence.xml @@ -20,9 +20,6 @@ true - - - @@ -38,20 +35,14 @@ - - - - + - - - - - + diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/BaseEntityManagerFunctionalTestCase.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/BaseEntityManagerFunctionalTestCase.java index f4d3bc8b42..d207b06437 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/BaseEntityManagerFunctionalTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/BaseEntityManagerFunctionalTestCase.java @@ -25,7 +25,6 @@ import org.hibernate.bytecode.enhance.spi.EnhancementContext; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.dialect.Dialect; -import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.jpa.HibernatePersistenceProvider; import org.hibernate.jpa.boot.spi.Bootstrap; @@ -199,7 +198,7 @@ public abstract class BaseEntityManagerFunctionalTestCase extends BaseUnitTestCa protected void addMappings(Map settings) { String[] mappings = getMappings(); if ( mappings != null ) { - settings.put( AvailableSettings.HBXML_FILES, String.join( ",", mappings ) ); + settings.put( AvailableSettings.HBM_XML_FILES, String.join( ",", mappings ) ); } } @@ -226,7 +225,7 @@ public abstract class BaseEntityManagerFunctionalTestCase extends BaseUnitTestCa if ( getEjb3DD().length > 0 ) { ArrayList dds = new ArrayList(); dds.addAll( Arrays.asList( getEjb3DD() ) ); - config.put( AvailableSettings.XML_FILE_NAMES, dds ); + config.put( AvailableSettings.ORM_XML_FILES, dds ); } config.put( GlobalTemporaryTableStrategy.DROP_ID_TABLES, "true" ); diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerFactoryClosedTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerFactoryClosedTest.java index 1a5e15c586..98a210071c 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerFactoryClosedTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerFactoryClosedTest.java @@ -13,7 +13,7 @@ import java.util.Map; import jakarta.persistence.EntityManagerFactory; import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.jta.TestingJtaBootstrap; import org.hibernate.testing.jta.TestingJtaPlatformImpl; @@ -35,7 +35,7 @@ public class EntityManagerFactoryClosedTest extends BaseEntityManagerFunctionalT protected void addConfigOptions(Map options) { super.addConfigOptions( options ); TestingJtaBootstrap.prepare(options); - options.put( AvailableSettings.TRANSACTION_TYPE, "JTA" ); + options.put( AvailableSettings.JPA_TRANSACTION_TYPE, "JTA" ); } /** diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerTest.java index 682b887731..114f3b0c1a 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerTest.java @@ -4,9 +4,6 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ - -//$Id$ - package org.hibernate.jpa.test; import java.io.ByteArrayInputStream; @@ -27,8 +24,8 @@ import jakarta.persistence.Query; import org.hibernate.FlushMode; import org.hibernate.HibernateException; import org.hibernate.Session; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.HibernateEntityManagerFactory; import org.hibernate.jpa.QueryHints; import org.hibernate.stat.Statistics; @@ -334,7 +331,7 @@ public class EntityManagerTest extends BaseEntityManagerFunctionalTestCase { // success } - assertTrue( properties.containsKey( AvailableSettings.FLUSH_MODE ) ); + assertTrue( properties.containsKey( org.hibernate.cfg.AvailableSettings.FLUSH_MODE ) ); } @Test @@ -347,7 +344,7 @@ public class EntityManagerTest extends BaseEntityManagerFunctionalTestCase { em.getTransaction().commit(); em.clear(); - assertEquals( em.getProperties().get( AvailableSettings.FLUSH_MODE ), "AUTO" ); + assertEquals( em.getProperties().get( org.hibernate.cfg.AvailableSettings.FLUSH_MODE ), "AUTO" ); assertNotNull( "With default settings the entity should be persisted on commit.", em.find( Wallet.class, wallet.getSerial() ) diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/persistenceunit/TwoPersistenceUnits2LCDisabledEnabled.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/persistenceunit/TwoPersistenceUnits2LCDisabledEnabled.java index 3c2519b893..13ef0a2e53 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/persistenceunit/TwoPersistenceUnits2LCDisabledEnabled.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/persistenceunit/TwoPersistenceUnits2LCDisabledEnabled.java @@ -36,7 +36,7 @@ public class TwoPersistenceUnits2LCDisabledEnabled { @TestForIssue( jiraKey = "HHH-11516" ) public void testDisabledEnabled() { final Map config = Environment.getProperties(); - config.put( org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, Collections.singletonList( AnEntity.class ) ); + config.put( AvailableSettings.LOADED_CLASSES, Collections.singletonList( AnEntity.class ) ); config.put( "javax.persistence.sharedCache.mode", SharedCacheMode.ENABLE_SELECTIVE ); config.put( AvailableSettings.USE_SECOND_LEVEL_CACHE, "false" ); diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/query/NativeQueryResultTypeAutoDiscoveryTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/query/NativeQueryResultTypeAutoDiscoveryTest.java index ac0f635f66..4f03c7b528 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/query/NativeQueryResultTypeAutoDiscoveryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/query/NativeQueryResultTypeAutoDiscoveryTest.java @@ -34,12 +34,12 @@ import org.hibernate.Session; import org.hibernate.annotations.Nationalized; import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.H2Dialect; import org.hibernate.dialect.MySQLDialect; import org.hibernate.dialect.PostgreSQL81Dialect; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.testing.orm.jpa.PersistenceUnitDescriptorAdapter; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitOverridesTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitOverridesTests.java index ce92b285da..030c48c83d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitOverridesTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitOverridesTests.java @@ -10,24 +10,14 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Properties; -import jakarta.persistence.Entity; -import jakarta.persistence.EntityManagerFactory; -import jakarta.persistence.Id; -import jakarta.persistence.metamodel.EntityType; -import jakarta.persistence.spi.PersistenceProvider; -import jakarta.persistence.spi.PersistenceUnitInfo; import javax.sql.DataSource; -import org.hibernate.boot.spi.MetadataImplementor; -import org.hibernate.boot.spi.SessionFactoryOptions; import org.hibernate.cache.spi.access.AccessType; import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl; import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; -import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess; -import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.jpa.HibernatePersistenceProvider; import org.hibernate.persister.entity.EntityPersister; @@ -40,6 +30,13 @@ import org.hibernate.testing.util.jpa.DelegatingPersistenceUnitInfo; import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter; import org.junit.Test; +import jakarta.persistence.Entity; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.Id; +import jakarta.persistence.metamodel.EntityType; +import jakarta.persistence.spi.PersistenceProvider; +import jakarta.persistence.spi.PersistenceUnitInfo; + import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; @@ -408,10 +405,10 @@ public class PersistenceUnitOverridesTests extends BaseUnitTestCase { }; final Map integrationSettings = new HashMap<>(); - integrationSettings.put( AvailableSettings.JAKARTA_JPA_JDBC_DRIVER, ConnectionProviderBuilder.DRIVER ); - integrationSettings.put( AvailableSettings.JAKARTA_JPA_JDBC_URL, ConnectionProviderBuilder.URL ); - integrationSettings.put( AvailableSettings.JAKARTA_JPA_JDBC_USER, ConnectionProviderBuilder.USER ); - integrationSettings.put( AvailableSettings.JAKARTA_JPA_JDBC_PASSWORD, ConnectionProviderBuilder.PASS ); + integrationSettings.put( AvailableSettings.JAKARTA_JDBC_DRIVER, ConnectionProviderBuilder.DRIVER ); + integrationSettings.put( AvailableSettings.JAKARTA_JDBC_URL, ConnectionProviderBuilder.URL ); + integrationSettings.put( AvailableSettings.JAKARTA_JDBC_USER, ConnectionProviderBuilder.USER ); + integrationSettings.put( AvailableSettings.JAKARTA_JDBC_PASSWORD, ConnectionProviderBuilder.PASS ); integrationSettings.put( "hibernate.connection.init_sql", "" ); final PersistenceProvider provider = new HibernatePersistenceProvider(); @@ -437,7 +434,7 @@ public class PersistenceUnitOverridesTests extends BaseUnitTestCase { final PersistenceUnitInfoAdapter info = new PersistenceUnitInfoAdapter() { private final Properties props = new Properties(); { - props.put( org.hibernate.jpa.AvailableSettings.CFG_FILE, "org/hibernate/orm/test/bootstrap/jpa/hibernate.cfg.xml" ); + props.put( AvailableSettings.CFG_XML_FILE, "org/hibernate/orm/test/bootstrap/jpa/hibernate.cfg.xml" ); } @Override @@ -478,7 +475,7 @@ public class PersistenceUnitOverridesTests extends BaseUnitTestCase { final PersistenceUnitInfoAdapter info = new PersistenceUnitInfoAdapter() { private final Properties props = new Properties(); { - props.put( org.hibernate.jpa.AvailableSettings.CFG_FILE, "org/hibernate/orm/test/bootstrap/jpa/hibernate.cfg.xml" ); + props.put( AvailableSettings.CFG_XML_FILE, "org/hibernate/orm/test/bootstrap/jpa/hibernate.cfg.xml" ); } @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/scanning/PackagedEntityManagerTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/scanning/PackagedEntityManagerTest.java index af4465d232..7dc4bb8498 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/scanning/PackagedEntityManagerTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/scanning/PackagedEntityManagerTest.java @@ -19,7 +19,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.event.service.spi.EventListenerRegistry; import org.hibernate.event.spi.EventType; import org.hibernate.internal.util.ConfigHelper; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.HibernateEntityManagerFactory; import org.hibernate.jpa.test.Distributor; import org.hibernate.jpa.test.Item; @@ -279,7 +279,7 @@ public class PackagedEntityManagerTest extends PackagingTestCase { addPackageToClasspath( testPackage ); HashMap properties = new HashMap(); - properties.put( AvailableSettings.JTA_DATASOURCE, null ); + properties.put( AvailableSettings.JPA_JTA_DATASOURCE, null ); Properties p = new Properties(); p.load( ConfigHelper.getResourceAsStream( "/overridenpar.properties" ) ); properties.putAll( p ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/CfgFilePropertyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/CfgFilePropertyTest.java index 317fb2e408..a7a50d0f1d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/CfgFilePropertyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/CfgFilePropertyTest.java @@ -37,7 +37,7 @@ public class CfgFilePropertyTest extends BaseUnitTestCase { Thread thread = new Thread( () -> { try { final Properties props = new Properties(); - props.setProperty( AvailableSettings.CFG_FILE, "/org/hibernate/orm/test/boot/cfgXml/hibernate.cfg.xml" ); + props.setProperty( AvailableSettings.CFG_XML_FILE, "/org/hibernate/orm/test/boot/cfgXml/hibernate.cfg.xml" ); Persistence.createEntityManagerFactory( "ExcludeUnlistedClassesTest1", props ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/exceptionhandling/BaseJpaOrNativeBootstrapFunctionalTestCase.java b/hibernate-core/src/test/java/org/hibernate/orm/test/exceptionhandling/BaseJpaOrNativeBootstrapFunctionalTestCase.java index 6aae22a92e..f559d876b9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/exceptionhandling/BaseJpaOrNativeBootstrapFunctionalTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/exceptionhandling/BaseJpaOrNativeBootstrapFunctionalTestCase.java @@ -13,10 +13,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; -import jakarta.persistence.EntityManager; -import jakarta.persistence.SharedCacheMode; -import jakarta.persistence.ValidationMode; -import jakarta.persistence.spi.PersistenceUnitTransactionType; import org.hibernate.HibernateException; import org.hibernate.Interceptor; @@ -26,13 +22,13 @@ import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl; import org.hibernate.bytecode.enhance.spi.EnhancementContext; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.internal.util.config.ConfigurationHelper; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.HibernatePersistenceProvider; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; @@ -45,6 +41,11 @@ import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.orm.junit.DialectContext; import org.junit.After; +import jakarta.persistence.EntityManager; +import jakarta.persistence.SharedCacheMode; +import jakarta.persistence.ValidationMode; +import jakarta.persistence.spi.PersistenceUnitTransactionType; + import static org.junit.Assert.fail; /** @@ -121,7 +122,7 @@ public abstract class BaseJpaOrNativeBootstrapFunctionalTestCase extends BaseUni ArrayList classes = new ArrayList(); classes.addAll( Arrays.asList( getAnnotatedClasses() ) ); - properties.put( AvailableSettings.LOADED_CLASSES, classes ); + properties.put( org.hibernate.cfg.AvailableSettings.LOADED_CLASSES, classes ); sessionFactory = Bootstrap.getEntityManagerFactoryBuilder( buildPersistenceUnitDescriptor(), diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/cdi/NoCdiAvailableTestDelegate.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/cdi/NoCdiAvailableTestDelegate.java index 3771d81dc3..03200b8206 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/cdi/NoCdiAvailableTestDelegate.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/cdi/NoCdiAvailableTestDelegate.java @@ -10,7 +10,7 @@ import java.util.Collections; import jakarta.persistence.EntityManagerFactory; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.HibernatePersistenceProvider; import org.hibernate.testing.orm.jpa.PersistenceUnitInfoAdapter; @@ -28,7 +28,7 @@ public class NoCdiAvailableTestDelegate { public static void passingBeanManager() { new HibernatePersistenceProvider().createContainerEntityManagerFactory( new PersistenceUnitInfoAdapter(), - Collections.singletonMap( AvailableSettings.CDI_BEAN_MANAGER, new Object() ) + Collections.singletonMap( AvailableSettings.JAKARTA_CDI_BEAN_MANAGER, new Object() ) ).close(); } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/GeneratedValueTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/GeneratedValueTests.java index e1f9a134f0..1d7e8d8559 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/GeneratedValueTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/GeneratedValueTests.java @@ -77,9 +77,7 @@ public class GeneratedValueTests extends BaseUnitTestCase { @Test public void testImplicitSequenceGenerator() { - try (final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder() - .applySetting( AvailableSettings.PREFER_GENERATOR_NAME_AS_DEFAULT_SEQUENCE_NAME, "false" ) - .build()) { + try (final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build()) { final Metadata bootModel = new MetadataSources( ssr ) .addAnnotatedClass( ImplicitSequenceGeneratorEntity.class ) .buildMetadata(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/ConfigurationObjectSettingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/ConfigurationObjectSettingTest.java index e5b7cea4ce..55997053b9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/ConfigurationObjectSettingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/ConfigurationObjectSettingTest.java @@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.fail; public class ConfigurationObjectSettingTest { @Test public void testSharedCacheMode() { - verifyCacheMode( AvailableSettings.JAKARTA_JPA_SHARED_CACHE_MODE ); + verifyCacheMode( AvailableSettings.JAKARTA_SHARED_CACHE_MODE ); verifyCacheMode( AvailableSettings.JPA_SHARED_CACHE_MODE ); } @@ -104,7 +104,7 @@ public class ConfigurationObjectSettingTest { @Test public void testValidationMode() { - verifyValidationMode( AvailableSettings.JAKARTA_JPA_VALIDATION_MODE ); + verifyValidationMode( AvailableSettings.JAKARTA_VALIDATION_MODE ); verifyValidationMode( AvailableSettings.JPA_VALIDATION_MODE ); } @@ -161,7 +161,7 @@ public class ConfigurationObjectSettingTest { @Test public void testValidationFactory() { - verifyValidatorFactory( AvailableSettings.JAKARTA_JPA_VALIDATION_FACTORY ); + verifyValidatorFactory( AvailableSettings.JAKARTA_VALIDATION_FACTORY ); verifyValidatorFactory( AvailableSettings.JPA_VALIDATION_FACTORY ); } @@ -189,10 +189,10 @@ public class ConfigurationObjectSettingTest { // ) public void testJdbcSettings() { verifyJdbcSettings( - AvailableSettings.JAKARTA_JPA_JDBC_URL, - AvailableSettings.JAKARTA_JPA_JDBC_DRIVER, - AvailableSettings.JAKARTA_JPA_JDBC_USER, - AvailableSettings.JAKARTA_JPA_JDBC_PASSWORD + AvailableSettings.JAKARTA_JDBC_URL, + AvailableSettings.JAKARTA_JDBC_DRIVER, + AvailableSettings.JAKARTA_JDBC_USER, + AvailableSettings.JAKARTA_JDBC_PASSWORD ); verifyJdbcSettings( AvailableSettings.JPA_JDBC_URL, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/DisableDiscardPersistenceContextOnCloseTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/DisableDiscardPersistenceContextOnCloseTest.java index 434c63c4bc..25884b4bfa 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/DisableDiscardPersistenceContextOnCloseTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/DisableDiscardPersistenceContextOnCloseTest.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.jpa.ejb3configuration; import java.sql.SQLException; import java.util.Map; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.test.Wallet; import org.hibernate.testing.orm.junit.DialectFeatureChecks; @@ -42,7 +42,7 @@ public class DisableDiscardPersistenceContextOnCloseTest { @BeforeAll public void init(EntityManagerFactoryScope scope) { Map props = scope.getEntityManagerFactory().getProperties(); - connectionProvider = (PreparedStatementSpyConnectionProvider) props.get( org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER ); + connectionProvider = (PreparedStatementSpyConnectionProvider) props.get( AvailableSettings.CONNECTION_PROVIDER ); } @AfterAll diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/EnableDiscardPersistenceContextOnCloseTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/EnableDiscardPersistenceContextOnCloseTest.java index ed8335bf29..e533c01744 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/EnableDiscardPersistenceContextOnCloseTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/EnableDiscardPersistenceContextOnCloseTest.java @@ -8,7 +8,7 @@ package org.hibernate.orm.test.jpa.ejb3configuration; import java.util.Map; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.test.Wallet; import org.hibernate.testing.orm.junit.DialectFeatureChecks; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/InterceptorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/InterceptorTest.java index c2bb6e1cfe..d1938865c5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/InterceptorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/InterceptorTest.java @@ -19,7 +19,7 @@ import org.hibernate.boot.SessionFactoryBuilder; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl; import org.hibernate.cfg.Environment; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.jpa.test.Distributor; import org.hibernate.jpa.test.Item; @@ -87,7 +87,7 @@ public class InterceptorTest { @Test public void testDeprecatedConfiguredSessionInterceptor() { Map settings = basicSettings(); - settings.put( AvailableSettings.SESSION_INTERCEPTOR, LocalExceptionInterceptor.class.getName() ); + settings.put( AvailableSettings.SESSION_SCOPED_INTERCEPTOR, LocalExceptionInterceptor.class.getName() ); buildEntityManagerFactory( settings ); Item i = new Item(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java index ea197b1ff3..7c66281a30 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java @@ -26,6 +26,7 @@ import org.hibernate.cache.spi.access.EntityDataAccess; import org.hibernate.cache.spi.access.NaturalIdDataAccess; import org.hibernate.cache.spi.entry.CacheEntry; import org.hibernate.cache.spi.entry.CacheEntryStructure; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.engine.internal.MutableEntityEntryFactory; import org.hibernate.engine.spi.CascadeStyle; import org.hibernate.engine.spi.EntityEntryFactory; @@ -35,7 +36,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.ValueInclusion; import org.hibernate.id.IdentifierGenerator; import org.hibernate.internal.FilterAliasGenerator; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.testing.orm.jpa.PersistenceUnitDescriptorAdapter; import org.hibernate.jpa.test.SettingsGenerator; @@ -59,7 +59,6 @@ import org.hibernate.persister.spi.PersisterClassResolver; import org.hibernate.persister.spi.PersisterCreationContext; import org.hibernate.persister.walking.spi.AttributeDefinition; import org.hibernate.persister.walking.spi.EntityIdentifierDefinition; -import org.hibernate.sql.ast.tree.from.TableGroup; import org.hibernate.tuple.entity.BytecodeEnhancementMetadataNonPojoImpl; import org.hibernate.tuple.entity.EntityMetamodel; import org.hibernate.tuple.entity.EntityTuplizer; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/SessionFactoryObserverTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/SessionFactoryObserverTest.java index a0c856131c..e5d0befb5f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/SessionFactoryObserverTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/SessionFactoryObserverTest.java @@ -6,20 +6,20 @@ */ package org.hibernate.orm.test.jpa.ejb3configuration; -import jakarta.persistence.EntityManagerFactory; - import java.util.Collections; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - import org.hibernate.SessionFactory; import org.hibernate.SessionFactoryObserver; -import org.hibernate.testing.orm.jpa.PersistenceUnitInfoAdapter; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder; +import org.hibernate.testing.orm.jpa.PersistenceUnitInfoAdapter; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import jakarta.persistence.EntityManagerFactory; + /** * @author Emmanuel Bernard */ diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/id/IdentifierGeneratorStrategyProviderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/id/IdentifierGeneratorStrategyProviderTest.java index d31b8b3814..c881711556 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/id/IdentifierGeneratorStrategyProviderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/id/IdentifierGeneratorStrategyProviderTest.java @@ -6,20 +6,20 @@ */ package org.hibernate.orm.test.jpa.ejb3configuration.id; -import jakarta.persistence.EntityManager; -import jakarta.persistence.EntityManagerFactory; - import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.hibernate.testing.orm.jpa.PersistenceUnitInfoAdapter; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.boot.spi.Bootstrap; +import org.hibernate.testing.orm.jpa.PersistenceUnitInfoAdapter; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; + /** * @author Emmanuel Bernard */ @@ -32,7 +32,8 @@ public class IdentifierGeneratorStrategyProviderTest { AvailableSettings.IDENTIFIER_GENERATOR_STRATEGY_PROVIDER, FunkyIdentifierGeneratorProvider.class.getName() ); - settings.put( AvailableSettings.LOADED_CLASSES, Collections.singletonList( Cable.class ) ); + + settings.put( org.hibernate.cfg.AvailableSettings.LOADED_CLASSES, Collections.singletonList( Cable.class ) ); final EntityManagerFactory entityManagerFactory = Bootstrap.getEntityManagerFactoryBuilder( new PersistenceUnitInfoAdapter(), diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/emops/FlushModeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/emops/FlushModeTest.java index 303cc49e25..072f25830b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/emops/FlushModeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/emops/FlushModeTest.java @@ -6,7 +6,7 @@ */ package org.hibernate.orm.test.jpa.emops; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; import org.hibernate.testing.orm.junit.Jpa; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/jakarta/JakartaSchemaToolingTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/jakarta/JakartaSchemaToolingTests.java index 4690a25d0c..9260cfb382 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/jakarta/JakartaSchemaToolingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/jakarta/JakartaSchemaToolingTests.java @@ -28,10 +28,10 @@ import org.junit.jupiter.api.Test; import static org.hibernate.cfg.AvailableSettings.HBM2DDL_DATABASE_ACTION; import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JDBC_DRIVER; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JDBC_PASSWORD; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JDBC_URL; -import static org.hibernate.cfg.AvailableSettings.JAKARTA_JPA_JDBC_USER; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_DRIVER; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_PASSWORD; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_URL; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_USER; import static org.hibernate.cfg.AvailableSettings.JPA_JDBC_DRIVER; import static org.hibernate.cfg.AvailableSettings.JPA_JDBC_PASSWORD; import static org.hibernate.cfg.AvailableSettings.JPA_JDBC_URL; @@ -50,7 +50,7 @@ import static org.hibernate.cfg.AvailableSettings.JPA_JDBC_USER; public class JakartaSchemaToolingTests { @Test public void testSchemaCreation() { - verifySchemaCreation( JAKARTA_HBM2DDL_DATABASE_ACTION, JAKARTA_JPA_JDBC_DRIVER, JAKARTA_JPA_JDBC_URL, JAKARTA_JPA_JDBC_USER, JAKARTA_JPA_JDBC_PASSWORD ); + verifySchemaCreation( JAKARTA_HBM2DDL_DATABASE_ACTION, JAKARTA_JDBC_DRIVER, JAKARTA_JDBC_URL, JAKARTA_JDBC_USER, JAKARTA_JDBC_PASSWORD ); verifySchemaCreation( HBM2DDL_DATABASE_ACTION, JPA_JDBC_DRIVER, JPA_JDBC_URL, JPA_JDBC_USER, JPA_JDBC_PASSWORD ); } @@ -89,13 +89,13 @@ public class JakartaSchemaToolingTests { try ( SessionFactoryImplementor sessionFactory = buildSessionFactory( JAKARTA_HBM2DDL_DATABASE_ACTION, Action.CREATE_DROP, HBM2DDL_DATABASE_ACTION, Action.NONE, - JAKARTA_JPA_JDBC_DRIVER, Environment.getProperties().get( AvailableSettings.DRIVER ), + JAKARTA_JDBC_DRIVER, Environment.getProperties().get( AvailableSettings.DRIVER ), JPA_JDBC_DRIVER, "does.not.exist", - JAKARTA_JPA_JDBC_URL, Environment.getProperties().get( AvailableSettings.URL ), + JAKARTA_JDBC_URL, Environment.getProperties().get( AvailableSettings.URL ), JPA_JDBC_URL, "jdbc:na:nowhere", - JAKARTA_JPA_JDBC_USER, Environment.getProperties().get( AvailableSettings.USER ), + JAKARTA_JDBC_USER, Environment.getProperties().get( AvailableSettings.USER ), JPA_JDBC_USER, "goofy", - JAKARTA_JPA_JDBC_PASSWORD, Environment.getProperties().get( AvailableSettings.PASS ), + JAKARTA_JDBC_PASSWORD, Environment.getProperties().get( AvailableSettings.PASS ), JPA_JDBC_PASSWORD, "goober" ) ) { tryQuery( sessionFactory ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockTest.java index ab5de5e79c..fb63006987 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockTest.java @@ -14,26 +14,20 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import jakarta.persistence.LockModeType; -import jakarta.persistence.LockTimeoutException; -import jakarta.persistence.OptimisticLockException; -import jakarta.persistence.PersistenceException; -import jakarta.persistence.PessimisticLockException; -import jakarta.persistence.Query; -import jakarta.persistence.QueryTimeoutException; + import org.hibernate.LockOptions; import org.hibernate.Session; import org.hibernate.TransactionException; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.CockroachDialect; import org.hibernate.dialect.DerbyDialect; -import org.hibernate.dialect.Dialect; import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.OracleDialect; import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.dialect.SQLServerDialect; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.QueryHints; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; + import org.hibernate.testing.DialectChecks; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialectFeature; @@ -41,9 +35,18 @@ import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.testing.util.ExceptionUtil; -import org.jboss.logging.Logger; import org.junit.Test; +import org.jboss.logging.Logger; + +import jakarta.persistence.LockModeType; +import jakarta.persistence.LockTimeoutException; +import jakarta.persistence.OptimisticLockException; +import jakarta.persistence.PersistenceException; +import jakarta.persistence.PessimisticLockException; +import jakarta.persistence.Query; +import jakarta.persistence.QueryTimeoutException; + import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -77,7 +80,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase { doInJPA( this::entityManagerFactory, em -> { Map properties = new HashMap(); - properties.put( AvailableSettings.LOCK_TIMEOUT, 0L ); + properties.put( AvailableSettings.JAKARTA_LOCK_TIMEOUT, 0L ); em.find( Lock.class, 1, LockModeType.PESSIMISTIC_WRITE, properties ); } ); @@ -109,7 +112,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase { try { TransactionUtil.setJdbcTimeout( entityManager.unwrap( Session.class ) ); Map properties = new HashMap(); - properties.put( AvailableSettings.LOCK_TIMEOUT, 0L ); + properties.put( AvailableSettings.JPA_LOCK_TIMEOUT, 0L ); entityManager.find( Lock.class, lock.getId(), LockModeType.PESSIMISTIC_WRITE, properties ); fail( "Exception should be thrown" ); @@ -679,7 +682,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase { log.info( "testContendedPessimisticReadLockTimeout: (BG) read write-locked entity" ); Map props = new HashMap(); // timeout is in milliseconds - props.put( AvailableSettings.LOCK_TIMEOUT, 1000 ); + props.put( AvailableSettings.JPA_LOCK_TIMEOUT, 1000 ); try { _entityManager.lock( lock2, LockModeType.PESSIMISTIC_READ, props ); } @@ -762,7 +765,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase { log.info( "testContendedPessimisticWriteLockTimeout: (BG) read write-locked entity" ); Map props = new HashMap(); // timeout is in milliseconds - props.put( AvailableSettings.LOCK_TIMEOUT, 1000 ); + props.put( AvailableSettings.JPA_LOCK_TIMEOUT, 1000 ); try { _entityManager.lock( lock2, LockModeType.PESSIMISTIC_WRITE, props ); } @@ -842,7 +845,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase { log.info( "testContendedPessimisticWriteLockNoWait: (BG) read write-locked entity" ); Map props = new HashMap(); // timeout of zero means no wait (for lock) - props.put( AvailableSettings.LOCK_TIMEOUT, 0 ); + props.put( AvailableSettings.JPA_LOCK_TIMEOUT, 0 ); try { _entityManager.lock( lock2, LockModeType.PESSIMISTIC_WRITE, props ); } @@ -1080,7 +1083,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase { final CountDownLatch latch = new CountDownLatch( 1 ); final Map timeoutProps = new HashMap(); - timeoutProps.put( AvailableSettings.LOCK_TIMEOUT, 1000 ); // 1 second timeout + timeoutProps.put( AvailableSettings.JPA_LOCK_TIMEOUT, 1000 ); // 1 second timeout final Lock lock = new Lock(); FutureTask bgTask = new FutureTask<>( diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockTimeoutPropertyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockTimeoutPropertyTest.java index c86f16a7c7..d8dbea8c8e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockTimeoutPropertyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockTimeoutPropertyTest.java @@ -11,8 +11,8 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.LockModeType; import jakarta.persistence.Query; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.H2Dialect; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.testing.RequiresDialect; @@ -31,7 +31,7 @@ import static org.junit.Assert.assertTrue; public class LockTimeoutPropertyTest extends BaseEntityManagerFunctionalTestCase { @Override protected void addConfigOptions(Map options) { - options.put( AvailableSettings.LOCK_TIMEOUT, "2000" ); + options.put( AvailableSettings.JPA_LOCK_TIMEOUT, "2000" ); } @Test @@ -51,9 +51,9 @@ public class LockTimeoutPropertyTest extends BaseEntityManagerFunctionalTestCase public void testTimeoutHint(){ EntityManager em = getOrCreateEntityManager(); em.getTransaction().begin(); - boolean b= em.getProperties().containsKey( AvailableSettings.LOCK_TIMEOUT ); + boolean b= em.getProperties().containsKey( AvailableSettings.JPA_LOCK_TIMEOUT ); assertTrue( b ); - int timeout = Integer.valueOf( em.getProperties().get( AvailableSettings.LOCK_TIMEOUT ).toString() ); + int timeout = Integer.valueOf( em.getProperties().get( AvailableSettings.JPA_LOCK_TIMEOUT ).toString() ); assertEquals( 2000, timeout); org.hibernate.query.Query q = (org.hibernate.query.Query) em.createQuery( "select u from UnversionedLock u" ); timeout = q.getLockOptions().getTimeOut(); @@ -61,7 +61,7 @@ public class LockTimeoutPropertyTest extends BaseEntityManagerFunctionalTestCase Query query = em.createQuery( "select u from UnversionedLock u" ); query.setLockMode(LockModeType.PESSIMISTIC_WRITE); - query.setHint( AvailableSettings.LOCK_TIMEOUT, 3000 ); + query.setHint( AvailableSettings.JPA_LOCK_TIMEOUT, 3000 ); q = (org.hibernate.query.Query) query; timeout = q.getLockOptions().getTimeOut(); assertEquals( 3000, timeout ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/QueryLockingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/QueryLockingTest.java index 925e29a66b..de8f02d644 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/QueryLockingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/QueryLockingTest.java @@ -8,6 +8,23 @@ package org.hibernate.orm.test.jpa.lock; import java.util.List; import java.util.Map; + +import org.hibernate.LockMode; +import org.hibernate.dialect.CockroachDialect; +import org.hibernate.dialect.SQLServerDialect; +import org.hibernate.internal.SessionImpl; +import org.hibernate.jpa.QueryHints; +import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; +import org.hibernate.query.NativeQuery; + +import org.hibernate.testing.DialectChecks; +import org.hibernate.testing.RequiresDialect; +import org.hibernate.testing.RequiresDialectFeature; +import org.hibernate.testing.SkipForDialect; +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.transaction.TransactionUtil; +import org.junit.Test; + import jakarta.persistence.Entity; import jakarta.persistence.EntityManager; import jakarta.persistence.Id; @@ -19,21 +36,6 @@ import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.JoinType; import jakarta.persistence.criteria.ParameterExpression; import jakarta.persistence.criteria.Root; -import org.hibernate.LockMode; -import org.hibernate.dialect.CockroachDialect; -import org.hibernate.dialect.SQLServerDialect; -import org.hibernate.internal.SessionImpl; -import org.hibernate.jpa.AvailableSettings; -import org.hibernate.jpa.QueryHints; -import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; -import org.hibernate.query.NativeQuery; -import org.hibernate.testing.DialectChecks; -import org.hibernate.testing.RequiresDialect; -import org.hibernate.testing.RequiresDialectFeature; -import org.hibernate.testing.SkipForDialect; -import org.hibernate.testing.TestForIssue; -import org.hibernate.testing.transaction.TransactionUtil; -import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -72,7 +74,7 @@ public class QueryLockingTest extends BaseEntityManagerFunctionalTestCase { assertNull( query.getLockOptions().getAliasSpecificLockMode( "l" ) ); assertEquals( LockMode.OPTIMISTIC, query.getLockOptions().getEffectiveLockMode( "l" ) ); - query.setHint( AvailableSettings.ALIAS_SPECIFIC_LOCK_MODE+".l", LockModeType.PESSIMISTIC_WRITE ); + query.setHint( QueryHints.HINT_NATIVE_LOCKMODE + ".l", LockModeType.PESSIMISTIC_WRITE ); assertEquals( LockMode.OPTIMISTIC, query.getLockOptions().getLockMode() ); assertEquals( LockMode.PESSIMISTIC_WRITE, query.getLockOptions().getAliasSpecificLockMode( "l" ) ); assertEquals( LockMode.PESSIMISTIC_WRITE, query.getLockOptions().getEffectiveLockMode( "l" ) ); @@ -135,7 +137,7 @@ public class QueryLockingTest extends BaseEntityManagerFunctionalTestCase { assertNull( query.getLockOptions().getAliasSpecificLockMode( "l" ) ); assertEquals( LockMode.OPTIMISTIC, query.getLockOptions().getEffectiveLockMode( "l" ) ); - query.setHint( AvailableSettings.ALIAS_SPECIFIC_LOCK_MODE+".l", LockModeType.PESSIMISTIC_WRITE ); + query.setHint( QueryHints.HINT_NATIVE_LOCKMODE +".l", LockModeType.PESSIMISTIC_WRITE ); assertEquals( LockMode.OPTIMISTIC, query.getLockOptions().getLockMode() ); assertEquals( LockMode.PESSIMISTIC_WRITE, query.getLockOptions().getAliasSpecificLockMode( "l" ) ); assertEquals( LockMode.PESSIMISTIC_WRITE, query.getLockOptions().getEffectiveLockMode( "l" ) ); @@ -185,7 +187,7 @@ public class QueryLockingTest extends BaseEntityManagerFunctionalTestCase { em = getOrCreateEntityManager(); em.getTransaction().begin(); Lockable reread = em.createQuery( "from Lockable l", Lockable.class ) - .setHint( AvailableSettings.ALIAS_SPECIFIC_LOCK_MODE+".l", LockModeType.PESSIMISTIC_FORCE_INCREMENT ) + .setHint( QueryHints.HINT_NATIVE_LOCKMODE + ".l", LockModeType.PESSIMISTIC_FORCE_INCREMENT ) .getSingleResult(); assertFalse( reread.getVersion().equals( initial ) ); em.getTransaction().commit(); @@ -238,7 +240,7 @@ public class QueryLockingTest extends BaseEntityManagerFunctionalTestCase { em = getOrCreateEntityManager(); em.getTransaction().begin(); Lockable reread = em.createQuery( "from Lockable l", Lockable.class ) - .setHint( AvailableSettings.ALIAS_SPECIFIC_LOCK_MODE+".l", LockModeType.OPTIMISTIC_FORCE_INCREMENT ) + .setHint( QueryHints.HINT_NATIVE_LOCKMODE + ".l", LockModeType.OPTIMISTIC_FORCE_INCREMENT ) .getSingleResult(); assertEquals( initial, reread.getVersion() ); em.getTransaction().commit(); @@ -320,7 +322,7 @@ public class QueryLockingTest extends BaseEntityManagerFunctionalTestCase { em = getOrCreateEntityManager(); em.getTransaction().begin(); Lockable reread = em.createQuery( "from Lockable l", Lockable.class ) - .setHint( AvailableSettings.ALIAS_SPECIFIC_LOCK_MODE+".l", LockModeType.OPTIMISTIC ) + .setHint( QueryHints.HINT_NATIVE_LOCKMODE + ".l", LockModeType.OPTIMISTIC ) .getSingleResult(); assertEquals( initial, reread.getVersion() ); assertTrue( em.unwrap( SessionImpl.class ).getActionQueue().hasBeforeTransactionActions() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/mapping/DefaultCascadeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/mapping/DefaultCascadeTest.java index 40de96016f..3a4ec35efa 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/mapping/DefaultCascadeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/mapping/DefaultCascadeTest.java @@ -82,7 +82,7 @@ public class DefaultCascadeTest { public static class EJB3DDMappingProvider extends NonStringValueSettingProvider { @Override public String getKey() { - return AvailableSettings.XML_FILE_NAMES; + return AvailableSettings.ORM_XML_FILES; } @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/attribute/MappedSuperclassWithAttributesTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/attribute/MappedSuperclassWithAttributesTest.java index 29795580c4..cfc7378ced 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/attribute/MappedSuperclassWithAttributesTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/attribute/MappedSuperclassWithAttributesTest.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.jpa.metagen.mappedsuperclass.attribute; import java.util.Arrays; import jakarta.persistence.EntityManagerFactory; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.test.TestingEntityManagerFactoryGenerator; import org.hibernate.testing.TestForIssue; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/embedded/MappedSuperclassWithEmbeddedTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/embedded/MappedSuperclassWithEmbeddedTest.java index bf017c24bb..7ab13658fc 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/embedded/MappedSuperclassWithEmbeddedTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/embedded/MappedSuperclassWithEmbeddedTest.java @@ -9,8 +9,8 @@ package org.hibernate.orm.test.jpa.metagen.mappedsuperclass.embedded; import jakarta.persistence.EntityManagerFactory; import java.util.Arrays; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.test.TestingEntityManagerFactoryGenerator; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.BaseUnitTest; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/embeddedid/MappedSuperclassWithEmbeddedIdTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/embeddedid/MappedSuperclassWithEmbeddedIdTest.java index 3088bf7294..89517c7dfa 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/embeddedid/MappedSuperclassWithEmbeddedIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/embeddedid/MappedSuperclassWithEmbeddedIdTest.java @@ -9,8 +9,8 @@ package org.hibernate.orm.test.jpa.metagen.mappedsuperclass.embeddedid; import jakarta.persistence.EntityManagerFactory; import java.util.Arrays; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.test.TestingEntityManagerFactoryGenerator; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.BaseUnitTest; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/idclass/MappedSuperclassWithEntityWithIdClassTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/idclass/MappedSuperclassWithEntityWithIdClassTest.java index 5410fb00dc..44a13b7347 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/idclass/MappedSuperclassWithEntityWithIdClassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/idclass/MappedSuperclassWithEntityWithIdClassTest.java @@ -9,8 +9,8 @@ package org.hibernate.orm.test.jpa.metagen.mappedsuperclass.idclass; import jakarta.persistence.EntityManagerFactory; import java.util.Arrays; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.test.TestingEntityManagerFactoryGenerator; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.BaseUnitTest; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/overridden/MappedSuperclassWithOverriddenAttributeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/overridden/MappedSuperclassWithOverriddenAttributeTest.java index c3a41cb50b..5863b971ef 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/overridden/MappedSuperclassWithOverriddenAttributeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metagen/mappedsuperclass/overridden/MappedSuperclassWithOverriddenAttributeTest.java @@ -9,7 +9,7 @@ package org.hibernate.orm.test.jpa.metagen.mappedsuperclass.overridden; import java.util.Arrays; import jakarta.persistence.EntityManagerFactory; -import org.hibernate.jpa.AvailableSettings; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.test.TestingEntityManagerFactoryGenerator; import org.hibernate.testing.TestForIssue; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest.java index 52a997ee6b..ab6331623b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest.java @@ -17,6 +17,7 @@ import jakarta.persistence.Entity; import jakarta.persistence.Id; import jakarta.persistence.Table; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder; @@ -47,7 +48,7 @@ public class SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest { ArrayList classes = new ArrayList(); classes.addAll( Arrays.asList( new Class[] {TestEntity.class} ) ); - config.put( org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, classes ); + config.put( AvailableSettings.LOADED_CLASSES, classes ); return config; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaDatabaseFileGenerationFailureTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaDatabaseFileGenerationFailureTest.java index f27853a7b9..f1ed7ed9ac 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaDatabaseFileGenerationFailureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaDatabaseFileGenerationFailureTest.java @@ -123,7 +123,7 @@ public class SchemaDatabaseFileGenerationFailureTest { ArrayList classes = new ArrayList<>(); classes.addAll( Arrays.asList( new Class[] { TestEntity.class } ) ); - config.put( org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, classes ); + config.put( AvailableSettings.LOADED_CLASSES, classes ); return config; } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationFailureTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationFailureTest.java index 5124c56dab..a327e87148 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationFailureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationFailureTest.java @@ -116,7 +116,7 @@ public class SchemaScriptFileGenerationFailureTest { ArrayList classes = new ArrayList<>(); classes.addAll( Arrays.asList( new Class[] { TestEntity.class } ) ); - config.put( org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, classes ); + config.put( AvailableSettings.LOADED_CLASSES, classes ); return config; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationTest.java index c0f74211fd..912721253a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationTest.java @@ -18,6 +18,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder; @@ -113,7 +114,7 @@ public class SchemaScriptFileGenerationTest { ArrayList classes = new ArrayList(); classes.addAll( Arrays.asList( new Class[] {TestEntity.class} ) ); - config.put( org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, classes ); + config.put( AvailableSettings.LOADED_CLASSES, classes ); return config; } } diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/BaseEnversJPAFunctionalTestCase.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/BaseEnversJPAFunctionalTestCase.java index 283092144e..be6a978af9 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/BaseEnversJPAFunctionalTestCase.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/BaseEnversJPAFunctionalTestCase.java @@ -10,12 +10,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import jakarta.persistence.EntityManager; -import jakarta.persistence.EntityManagerFactory; -import jakarta.transaction.SystemException; import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl; import org.hibernate.boot.spi.MetadataImplementor; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.H2Dialect; @@ -26,7 +24,6 @@ import org.hibernate.envers.AuditReaderFactory; import org.hibernate.envers.boot.internal.EnversIntegrator; import org.hibernate.envers.configuration.EnversSettings; import org.hibernate.internal.util.StringHelper; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; @@ -42,6 +39,10 @@ import org.hibernate.testing.orm.jpa.PersistenceUnitDescriptorAdapter; import org.hibernate.testing.orm.junit.DialectContext; import org.junit.After; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.transaction.SystemException; + /** * @author Strong Liu (stliu@hibernate.org) */ @@ -99,7 +100,7 @@ public abstract class BaseEnversJPAFunctionalTestCase extends AbstractEnversTest addMappings( settings ); if ( createSchema() ) { - settings.put( org.hibernate.cfg.AvailableSettings.HBM2DDL_AUTO, "create-drop" ); + settings.put( AvailableSettings.HBM2DDL_AUTO, "create-drop" ); final String secondSchemaName = createSecondSchema(); if ( StringHelper.isNotEmpty( secondSchemaName ) ) { if ( !(getDialect() instanceof H2Dialect) ) { @@ -119,8 +120,8 @@ public abstract class BaseEnversJPAFunctionalTestCase extends AbstractEnversTest settings.put( EnversSettings.USE_REVISION_ENTITY_WITH_NATIVE_ID, "false" ); - settings.put( org.hibernate.cfg.AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" ); - settings.put( org.hibernate.cfg.AvailableSettings.DIALECT, getDialect().getClass().getName() ); + settings.put( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" ); + settings.put( AvailableSettings.DIALECT, getDialect().getClass().getName() ); return settings; } @@ -140,14 +141,14 @@ public abstract class BaseEnversJPAFunctionalTestCase extends AbstractEnversTest if ( getEjb3DD().length > 0 ) { ArrayList dds = new ArrayList(); dds.addAll( Arrays.asList( getEjb3DD() ) ); - config.put( AvailableSettings.XML_FILE_NAMES, dds ); + config.put( AvailableSettings.ORM_XML_FILES, dds ); } config.put( GlobalTemporaryTableStrategy.DROP_ID_TABLES, "true" ); config.put( LocalTemporaryTableStrategy.DROP_ID_TABLES, "true" ); - if ( !Environment.getProperties().containsKey( Environment.CONNECTION_PROVIDER ) ) { + if ( !Environment.getProperties().containsKey( AvailableSettings.CONNECTION_PROVIDER ) ) { config.put( - org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER, + AvailableSettings.CONNECTION_PROVIDER, SharedDriverManagerConnectionProviderImpl.getInstance() ); } @@ -160,7 +161,7 @@ public abstract class BaseEnversJPAFunctionalTestCase extends AbstractEnversTest protected void addMappings(Map settings) { String[] mappings = getMappings(); if ( mappings != null ) { - settings.put( AvailableSettings.HBXML_FILES, String.join( ",", mappings ) ); + settings.put( AvailableSettings.HBM_XML_FILES, String.join( ",", mappings ) ); } } diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/performance/AbstractEntityManagerTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/performance/AbstractEntityManagerTest.java index 1b7ef517cf..a85b6c4f4f 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/performance/AbstractEntityManagerTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/performance/AbstractEntityManagerTest.java @@ -13,6 +13,7 @@ import jakarta.persistence.EntityManager; import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder; import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; import org.hibernate.dialect.Dialect; import org.hibernate.envers.AuditReader; @@ -20,7 +21,6 @@ import org.hibernate.envers.AuditReaderFactory; import org.hibernate.envers.configuration.EnversSettings; import org.hibernate.envers.boot.internal.EnversIntegrator; import org.hibernate.orm.test.envers.AbstractEnversTest; -import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.HibernateEntityManagerFactory; import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; import org.hibernate.jpa.boot.spi.Bootstrap; diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/EntityManagerFactoryBasedFunctionalTest.java b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/EntityManagerFactoryBasedFunctionalTest.java index a517c847cb..97725a1949 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/EntityManagerFactoryBasedFunctionalTest.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/EntityManagerFactoryBasedFunctionalTest.java @@ -15,16 +15,10 @@ import java.util.Map; import java.util.Properties; import java.util.function.Consumer; import java.util.function.Function; -import jakarta.persistence.EntityManager; -import jakarta.persistence.EntityManagerFactory; -import jakarta.persistence.SharedCacheMode; -import jakarta.persistence.ValidationMode; -import jakarta.persistence.spi.PersistenceUnitTransactionType; import org.hibernate.bytecode.enhance.spi.EnhancementContext; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; -import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.jpa.HibernatePersistenceProvider; import org.hibernate.jpa.boot.spi.Bootstrap; import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; @@ -36,6 +30,12 @@ import org.junit.jupiter.api.AfterEach; import org.jboss.logging.Logger; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.SharedCacheMode; +import jakarta.persistence.ValidationMode; +import jakarta.persistence.spi.PersistenceUnitTransactionType; + import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; /** @@ -122,23 +122,23 @@ public class EntityManagerFactoryBasedFunctionalTest ArrayList> classes = new ArrayList<>(); classes.addAll( Arrays.asList( getAnnotatedClasses() ) ); - config.put( org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, classes ); + config.put( AvailableSettings.LOADED_CLASSES, classes ); for ( Map.Entry entry : getCachedClasses().entrySet() ) { config.put( - org.hibernate.jpa.AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(), + AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(), entry.getValue() ); } for ( Map.Entry entry : getCachedCollections().entrySet() ) { config.put( - org.hibernate.jpa.AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(), + AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(), entry.getValue() ); } if ( getEjb3DD().length > 0 ) { ArrayList dds = new ArrayList<>(); dds.addAll( Arrays.asList( getEjb3DD() ) ); - config.put( org.hibernate.jpa.AvailableSettings.XML_FILE_NAMES, dds ); + config.put( AvailableSettings.ORM_XML_FILES, dds ); } config.put( GlobalTemporaryTableStrategy.DROP_ID_TABLES, "true" ); @@ -156,7 +156,7 @@ public class EntityManagerFactoryBasedFunctionalTest protected void applySettings(Map settings) { String[] mappings = getMappings(); if ( mappings != null ) { - settings.put( org.hibernate.jpa.AvailableSettings.HBXML_FILES, String.join( ",", mappings ) ); + settings.put( AvailableSettings.HBM_XML_FILES, String.join( ",", mappings ) ); } } diff --git a/release/release.gradle b/release/release.gradle index 932d4bf3b3..934a918261 100644 --- a/release/release.gradle +++ b/release/release.gradle @@ -138,6 +138,7 @@ dependencies { javadocClasspath libraries.jakarta_cdi javadocClasspath libraries.jakarta_jacc javadocClasspath libraries.ant + javadocClasspath libraries.postgresql javadocClasspath gradleApi() }