parent
05b2ca3b83
commit
986d65a288
|
@ -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
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.util.function.Function;
|
|||
/**
|
||||
* ConnectionProvider based on Agroal connection pool
|
||||
* To use this ConnectionProvider set: <pre> hibernate.connection.provider_class AgroalConnectionProvider </pre>
|
||||
* ( @see AvailableSettings#CONNECTION_PROVIDER )
|
||||
*
|
||||
* Usual hibernate properties are supported:
|
||||
* <pre>
|
||||
|
@ -46,6 +45,8 @@ import java.util.function.Function;
|
|||
*
|
||||
* Other configuration options are available, using the <pre>hibernate.agroal</pre> prefix ( @see AgroalPropertiesReader )
|
||||
*
|
||||
* @see AvailableSettings#CONNECTION_PROVIDER
|
||||
*
|
||||
* @author Luis Barreiro
|
||||
*/
|
||||
public class AgroalConnectionProvider implements ConnectionProvider, Configurable, Stoppable {
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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() ) ) ) {
|
||||
|
|
|
@ -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<String, Object> 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")
|
||||
|
|
|
@ -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(
|
||||
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,
|
||||
configurationSettings.get( AvailableSettings.JAKARTA_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<? extends Interceptor> 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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -259,8 +259,6 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
|
|||
|
||||
boolean isPreferUserTransaction();
|
||||
|
||||
boolean isProcedureParameterNullPassingEnabled();
|
||||
|
||||
boolean isAllowOutOfTransactionUpdateOperations();
|
||||
|
||||
boolean isReleaseResourcesOnCloseEnabled();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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 );
|
||||
|
||||
|
|
|
@ -557,7 +557,7 @@ class TypeSafeActivator {
|
|||
}
|
||||
},
|
||||
cfgService.getSetting(
|
||||
AvailableSettings.JAKARTA_JPA_VALIDATION_FACTORY,
|
||||
AvailableSettings.JAKARTA_VALIDATION_FACTORY,
|
||||
new ConfigurationService.Converter<ValidatorFactory>() {
|
||||
@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()
|
||||
)
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.ejb;
|
||||
|
||||
/**
|
||||
* @deprecated use org.hibernate.jpa.AvailableSettings
|
||||
*/
|
||||
@Deprecated
|
||||
public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings {
|
||||
}
|
|
@ -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<JdbcEn
|
|||
true
|
||||
);
|
||||
|
||||
if ( configurationValues.containsKey( AvailableSettings.DIALECT_DB_NAME ) ) {
|
||||
final Object dbName = NullnessHelper.coalesceSuppliedValues(
|
||||
() -> 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
|
||||
|
|
|
@ -382,15 +382,10 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String tableName = ConfigurationHelper.getString( TABLE_PARAM, params, fallbackTableName );
|
||||
|
||||
|
|
|
@ -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<String, Object> 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<String, Object> 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;
|
||||
}
|
||||
|
|
|
@ -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<String, Object> 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 );
|
||||
}
|
||||
|
|
|
@ -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<String, Object> 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<String, Object> 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 ),
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.jpa;
|
||||
|
||||
/**
|
||||
* Defines the available HEM settings, both JPA-defined as well as Hibernate-specific
|
||||
* <p/>
|
||||
* 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:<ul>
|
||||
* <li>
|
||||
* <b>enabled</b> - Do the build
|
||||
* </li>
|
||||
* <li>
|
||||
* <b>disabled</b> - Do not do the build
|
||||
* </li>
|
||||
* <li>
|
||||
* <b>ignoreUnsupported</b> - Do the build, but ignore any non-JPA features that would otherwise
|
||||
* result in a failure.
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* @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}).
|
||||
* <p/>
|
||||
* Either {@link org.hibernate.LockMode} or {@link jakarta.persistence.LockModeType}
|
||||
* are accepted. Also the String names of either are accepted as well. <tt>null</tt>
|
||||
* is additionally accepted as meaning {@link org.hibernate.LockMode#NONE}.
|
||||
* <p/>
|
||||
* Usage is to concatenate this setting name and the alias name together, separated
|
||||
* by a dot. For example<code>Query.setHint( "org.hibernate.lockMode.a", someLockMode )</code>
|
||||
* would apply <code>someLockMode</code> to the alias <code>"a"</code>.
|
||||
*/
|
||||
//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.<fully.qualified.Classname> 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.<fully.qualified.Classname>.<role> 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.
|
||||
* <p/>
|
||||
* Values are {@code true} grants access, {@code false} does not.
|
||||
* <p/>
|
||||
* The default behavior is to allow access unless the session is bootstrapped via JPA.
|
||||
*/
|
||||
String ALLOW_JTA_TRANSACTION_ACCESS = "hibernate.jta.allowTransactionAccess";
|
||||
}
|
|
@ -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 <i>hibernate.ejb.entitymanager_factory_name</i>.
|
||||
* 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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -90,6 +90,12 @@ 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).
|
||||
|
@ -97,14 +103,20 @@ public class QueryHints {
|
|||
* 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
|
||||
|
|
|
@ -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<ConverterDescriptor> converterDescriptors = null;
|
||||
|
||||
// add any explicit Class references passed in
|
||||
final List<Class> loadedAnnotatedClasses = (List<Class>) configurationValues.remove( AvailableSettings.LOADED_CLASSES );
|
||||
final List<Class> loadedAnnotatedClasses = (List<Class>) 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<String> explicitOrmXmlList = (List<String>) configurationValues.remove( AvailableSettings.XML_FILE_NAMES );
|
||||
final List<String> explicitOrmXmlList = (List<String>) configurationValues.remove( org.hibernate.cfg.AvailableSettings.ORM_XML_FILES );
|
||||
if ( explicitOrmXmlList != null ) {
|
||||
explicitOrmXmlList.forEach( metadataSources::addResource );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 {
|
||||
|
||||
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_JPA_PERSISTENCE_PROVIDER
|
||||
AvailableSettings.JAKARTA_PERSISTENCE_PROVIDER
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
);
|
||||
|
||||
return setting == null ? null : setting.trim();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<R> implements QueryImplementor<R> {
|
|||
|
||||
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<String, LockMode> 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<R> implements QueryImplementor<R> {
|
|||
|
||||
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<R> implements QueryImplementor<R> {
|
|||
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<R> implements QueryImplementor<R> {
|
|||
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<R> implements QueryImplementor<R> {
|
|||
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 ) );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<persistence-unit name="cfgxmlpar" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||
<properties>
|
||||
<property name="hibernate.ejb.cfgfile" value="/org/hibernate/jpa/test/pack/cfgxmlpar/hibernate.cfg.xml"/>
|
||||
<property name="hibernate.cfg_xml_file" value="/org/hibernate/jpa/test/pack/cfgxmlpar/hibernate.cfg.xml"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||
<properties>
|
||||
<!-- custom scanner test -->
|
||||
<property name="hibernate.ejb.resource_scanner" value="org.hibernate.orm.test.bootstrap.scanning.CustomScanner"/>
|
||||
<property name="hibernate.archive.scanner" value="org.hibernate.orm.test.bootstrap.scanning.CustomScanner"/>
|
||||
|
||||
<property name="hibernate.dialect" value="@db.dialect@"/>
|
||||
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
|
||||
|
@ -35,20 +35,14 @@
|
|||
<property name="hibernate.generate_statistics" value="true"/>
|
||||
<property name="hibernate.cache.region.factory_class" value="org.hibernate.testing.cache.CachingRegionFactory" />
|
||||
<property name="hibernate.physical_naming_strategy" value="org.hibernate.jpa.test.MyNamingStrategy"/>
|
||||
<!-- test naming strategy and fall back to element content -->
|
||||
<!-- property name="hibernate.ejb.naming_strategy">MyNamingStrategy</property -->
|
||||
|
||||
<!-- cache configuration -->
|
||||
<property name="hibernate.ejb.classcache.org.hibernate.jpa.test.Item" value="read-write"/>
|
||||
<property name="hibernate.ejb.collectioncache.org.hibernate.jpa.test.Item.distributors"
|
||||
<property name="hibernate.classcache.org.hibernate.jpa.test.Item" value="read-write"/>
|
||||
<property name="hibernate.collectioncache.org.hibernate.jpa.test.Item.distributors"
|
||||
value="read-write, RegionName"/>
|
||||
|
||||
<!-- event overriding -->
|
||||
<property name="hibernate.ejb.event.pre-insert" value="org.hibernate.jpa.test.NoOpListener"/>
|
||||
<!-- remove JACC and validator -->
|
||||
|
||||
<!-- alternatively to <class> and <property> declarations, you can use a regular hibernate.cfg.xml file -->
|
||||
<!-- property name="hibernate.ejb.cfgfile" value="/resource-path/to/hibernate.cfg.xml"/ -->
|
||||
<property name="hibernate.event.listener.pre-insert" value="org.hibernate.jpa.test.NoOpListener"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||
|
||||
<properties>
|
||||
<!-- custom scanner test -->
|
||||
<!--<property name="hibernate.ejb.resource_scanner" value="org.hibernate.orm.test.bootstrap.scanning.CustomScanner"/>-->
|
||||
|
||||
<property name="hibernate.dialect" value="@db.dialect@"/>
|
||||
<property name="hibernate.connection.driver_class" value="@jdbc.driver@"/>
|
||||
<property name="hibernate.connection.username" value="@jdbc.user@"/>
|
||||
|
@ -38,20 +35,14 @@
|
|||
<property name="hibernate.generate_statistics" value="true"/>
|
||||
<property name="hibernate.cache.region.factory_class" value="org.hibernate.testing.cache.CachingRegionFactory" />
|
||||
<property name="hibernate.physical_naming_strategy" value="org.hibernate.jpa.test.MyNamingStrategy"/>
|
||||
<!-- test naming strategy and fall back to element content -->
|
||||
<!-- property name="hibernate.ejb.naming_strategy">MyNamingStrategy</property -->
|
||||
|
||||
<!-- cache configuration -->
|
||||
<property name="hibernate.ejb.classcache.org.hibernate.jpa.test.Item" value="read-write"/>
|
||||
<property name="hibernate.ejb.collectioncache.org.hibernate.jpa.test.Item.distributors"
|
||||
<property name="hibernate.classcache.org.hibernate.jpa.test.Item" value="read-write"/>
|
||||
<property name="hibernate.collectioncache.org.hibernate.jpa.test.Item.distributors"
|
||||
value="read-write, RegionName"/>
|
||||
|
||||
<!-- event overriding -->
|
||||
<property name="hibernate.ejb.event.pre-insert" value="org.hibernate.jpa.test.NoOpListener"/>
|
||||
<!-- remove JACC and validator -->
|
||||
|
||||
<!-- alternatively to <class> and <property> declarations, you can use a regular hibernate.cfg.xml file -->
|
||||
<!-- property name="hibernate.ejb.cfgfile" value="/resource-path/to/hibernate.cfg.xml"/ -->
|
||||
<property name="hibernate.event.listener.pre-insert" value="org.hibernate.jpa.test.NoOpListener"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
|
|
|
@ -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<String> dds = new ArrayList<String>();
|
||||
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" );
|
||||
|
|
|
@ -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" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
//$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() )
|
||||
|
|
|
@ -36,7 +36,7 @@ public class TwoPersistenceUnits2LCDisabledEnabled {
|
|||
@TestForIssue( jiraKey = "HHH-11516" )
|
||||
public void testDisabledEnabled() {
|
||||
final Map<Object, Object> 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" );
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<String,Object> 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
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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<Class> classes = new ArrayList<Class>();
|
||||
|
||||
classes.addAll( Arrays.asList( getAnnotatedClasses() ) );
|
||||
properties.put( AvailableSettings.LOADED_CLASSES, classes );
|
||||
properties.put( org.hibernate.cfg.AvailableSettings.LOADED_CLASSES, classes );
|
||||
|
||||
sessionFactory = Bootstrap.getEntityManagerFactoryBuilder(
|
||||
buildPersistenceUnitDescriptor(),
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 <a href="mailto:emmanuel@hibernate.org">Emmanuel Bernard</a>
|
||||
*/
|
||||
|
|
|
@ -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 <a href="mailto:emmanuel@hibernate.org">Emmanuel Bernard</a>
|
||||
*/
|
||||
|
@ -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(),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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<String, Object> properties = new HashMap<String, Object>();
|
||||
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<String, Object> properties = new HashMap<String, Object>();
|
||||
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<String, Object> props = new HashMap<String, Object>();
|
||||
// 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<String, Object> props = new HashMap<String, Object>();
|
||||
// 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<String, Object> props = new HashMap<String, Object>();
|
||||
// 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<String, Object> timeoutProps = new HashMap<String, Object>();
|
||||
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<Boolean> bgTask = new FutureTask<>(
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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() );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<Class> classes = new ArrayList<Class>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public class SchemaDatabaseFileGenerationFailureTest {
|
|||
ArrayList<Class> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public class SchemaScriptFileGenerationFailureTest {
|
|||
ArrayList<Class> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Class> classes = new ArrayList<Class>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String> dds = new ArrayList<String>();
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<Class<?>> 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<Class, String> 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<String, String> 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<String> 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<Object, Object> 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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ dependencies {
|
|||
javadocClasspath libraries.jakarta_cdi
|
||||
javadocClasspath libraries.jakarta_jacc
|
||||
javadocClasspath libraries.ant
|
||||
javadocClasspath libraries.postgresql
|
||||
javadocClasspath gradleApi()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue