false is the default for getBoolean()

This commit is contained in:
Gavin 2023-05-12 18:09:28 +02:00 committed by Christian Beikov
parent 556cb4ad5c
commit 9b4ed961b8
13 changed files with 22 additions and 39 deletions

View File

@ -511,18 +511,16 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.commentsEnabled = getBoolean( USE_SQL_COMMENTS, configurationSettings ); this.commentsEnabled = getBoolean( USE_SQL_COMMENTS, configurationSettings );
this.preferUserTransaction = getBoolean( PREFER_USER_TRANSACTION, configurationSettings, false ); this.preferUserTransaction = getBoolean( PREFER_USER_TRANSACTION, configurationSettings );
this.allowOutOfTransactionUpdateOperations = getBoolean( this.allowOutOfTransactionUpdateOperations = getBoolean(
ALLOW_UPDATE_OUTSIDE_TRANSACTION, ALLOW_UPDATE_OUTSIDE_TRANSACTION,
configurationSettings, configurationSettings
false
); );
this.releaseResourcesOnCloseEnabled = getBoolean( this.releaseResourcesOnCloseEnabled = getBoolean(
DISCARD_PC_ON_CLOSE, DISCARD_PC_ON_CLOSE,
configurationSettings, configurationSettings
false
); );
Object jdbcTimeZoneValue = configurationSettings.get( Object jdbcTimeZoneValue = configurationSettings.get(
@ -556,8 +554,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.failOnPaginationOverCollectionFetchEnabled = getBoolean( this.failOnPaginationOverCollectionFetchEnabled = getBoolean(
FAIL_ON_PAGINATION_OVER_COLLECTION_FETCH, FAIL_ON_PAGINATION_OVER_COLLECTION_FETCH,
configurationSettings, configurationSettings
false
); );
this.immutableEntityUpdateQueryHandlingMode = ImmutableEntityUpdateQueryHandlingMode.interpret( this.immutableEntityUpdateQueryHandlingMode = ImmutableEntityUpdateQueryHandlingMode.interpret(
@ -569,8 +566,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.inClauseParameterPaddingEnabled = getBoolean( this.inClauseParameterPaddingEnabled = getBoolean(
IN_CLAUSE_PARAMETER_PADDING, IN_CLAUSE_PARAMETER_PADDING,
configurationSettings, configurationSettings
false
); );
this.queryStatisticsMaxSize = getInt( this.queryStatisticsMaxSize = getInt(

View File

@ -84,11 +84,7 @@ public class DriverManagerConnectionProviderImpl
} }
private PooledConnections buildPool(Map<String,Object> configurationValues, ServiceRegistryImplementor serviceRegistry) { private PooledConnections buildPool(Map<String,Object> configurationValues, ServiceRegistryImplementor serviceRegistry) {
final boolean autoCommit = ConfigurationHelper.getBoolean( final boolean autoCommit = ConfigurationHelper.getBoolean( AvailableSettings.AUTOCOMMIT, configurationValues );
AvailableSettings.AUTOCOMMIT,
configurationValues,
false
);
final int minSize = ConfigurationHelper.getInt( MIN_SIZE, configurationValues, 1 ); final int minSize = ConfigurationHelper.getInt( MIN_SIZE, configurationValues, 1 );
final int maxSize = ConfigurationHelper.getInt( AvailableSettings.POOL_SIZE, configurationValues, 20 ); final int maxSize = ConfigurationHelper.getInt( AvailableSettings.POOL_SIZE, configurationValues, 20 );
final int initialSize = ConfigurationHelper.getInt( INITIAL_SIZE, configurationValues, minSize ); final int initialSize = ConfigurationHelper.getInt( INITIAL_SIZE, configurationValues, minSize );
@ -170,7 +166,7 @@ public class DriverManagerConnectionProviderImpl
CONNECTIONS_MESSAGE_LOGGER.connectionProperties( ConfigurationHelper.maskOut( connectionProps, "password" ) ); CONNECTIONS_MESSAGE_LOGGER.connectionProperties( ConfigurationHelper.maskOut( connectionProps, "password" ) );
} }
final boolean autoCommit = ConfigurationHelper.getBoolean( AvailableSettings.AUTOCOMMIT, configurationValues, false ); final boolean autoCommit = ConfigurationHelper.getBoolean( AvailableSettings.AUTOCOMMIT, configurationValues );
CONNECTIONS_MESSAGE_LOGGER.autoCommitMode( autoCommit ); CONNECTIONS_MESSAGE_LOGGER.autoCommitMode( autoCommit );
final Integer isolation = ConnectionProviderInitiator.extractIsolation( configurationValues ); final Integer isolation = ConnectionProviderInitiator.extractIsolation( configurationValues );

View File

@ -26,9 +26,9 @@ public class SqlStatementLoggerInitiator implements StandardServiceInitiator<Sql
@Override @Override
public SqlStatementLogger initiateService(Map<String, Object> configValues, ServiceRegistryImplementor registry) { public SqlStatementLogger initiateService(Map<String, Object> configValues, ServiceRegistryImplementor registry) {
final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues, false ); final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues );
final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false ); final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues );
final boolean highlightSQL = ConfigurationHelper.getBoolean( Environment.HIGHLIGHT_SQL, configValues, false ); final boolean highlightSQL = ConfigurationHelper.getBoolean( Environment.HIGHLIGHT_SQL, configValues );
final long logSlowQuery = ConfigurationHelper.getLong( Environment.LOG_SLOW_QUERY, configValues, 0 ); final long logSlowQuery = ConfigurationHelper.getLong( Environment.LOG_SLOW_QUERY, configValues, 0 );
return new SqlStatementLogger( showSQL, formatSQL, highlightSQL, logSlowQuery ); return new SqlStatementLogger( showSQL, formatSQL, highlightSQL, logSlowQuery );

View File

@ -193,7 +193,6 @@ public class SequenceStyleGenerator
final Dialect dialect = jdbcEnvironment.getDialect(); final Dialect dialect = jdbcEnvironment.getDialect();
this.identifierType = type; this.identifierType = type;
boolean forceTableUse = ConfigurationHelper.getBoolean( FORCE_TBL_PARAM, parameters, false );
final QualifiedName sequenceName = determineSequenceName(parameters, dialect, jdbcEnvironment, serviceRegistry ); final QualifiedName sequenceName = determineSequenceName(parameters, dialect, jdbcEnvironment, serviceRegistry );
@ -204,6 +203,7 @@ public class SequenceStyleGenerator
final boolean isPooledOptimizer = OptimizerFactory.isPooledOptimizer( optimizationStrategy ); final boolean isPooledOptimizer = OptimizerFactory.isPooledOptimizer( optimizationStrategy );
boolean forceTableUse = ConfigurationHelper.getBoolean( FORCE_TBL_PARAM, parameters );
SequenceMismatchStrategy sequenceMismatchStrategy = configurationService.getSetting( SequenceMismatchStrategy sequenceMismatchStrategy = configurationService.getSetting(
AvailableSettings.SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY, AvailableSettings.SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY,

View File

@ -487,7 +487,7 @@ public class TableGenerator implements PersistentIdentifierGenerator {
* @return The default segment value to use. * @return The default segment value to use.
*/ */
protected String determineDefaultSegmentValue(Properties params) { protected String determineDefaultSegmentValue(Properties params) {
final boolean preferSegmentPerEntity = getBoolean( CONFIG_PREFER_SEGMENT_PER_ENTITY, params, false ); final boolean preferSegmentPerEntity = getBoolean( CONFIG_PREFER_SEGMENT_PER_ENTITY, params );
final String defaultToUse = preferSegmentPerEntity ? params.getProperty( TABLE ) : DEF_SEGMENT_VALUE; final String defaultToUse = preferSegmentPerEntity ? params.getProperty( TABLE ) : DEF_SEGMENT_VALUE;
LOG.usingDefaultIdGeneratorSegmentValue( qualifiedTableName.render(), segmentColumnName, defaultToUse ); LOG.usingDefaultIdGeneratorSegmentValue( qualifiedTableName.render(), segmentColumnName, defaultToUse );
return defaultToUse; return defaultToUse;

View File

@ -1614,8 +1614,7 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
} }
private void logIfEmptyCompositesEnabled(Map<String, Object> props ) { private void logIfEmptyCompositesEnabled(Map<String, Object> props ) {
final boolean isEmptyCompositesEnabled = final boolean isEmptyCompositesEnabled = getBoolean( CREATE_EMPTY_COMPOSITES_ENABLED, props );
getBoolean( CREATE_EMPTY_COMPOSITES_ENABLED, props, false );
if ( isEmptyCompositesEnabled ) { if ( isEmptyCompositesEnabled ) {
LOG.emptyCompositesEnabled(); LOG.emptyCompositesEnabled();
} }

View File

@ -30,11 +30,7 @@ public class MutableJpaComplianceImpl implements MutableJpaCompliance {
public MutableJpaComplianceImpl(Map<?,?> configurationSettings) { public MutableJpaComplianceImpl(Map<?,?> configurationSettings) {
this( this(
configurationSettings, configurationSettings,
ConfigurationHelper.getBoolean( ConfigurationHelper.getBoolean( AvailableSettings.JPA_COMPLIANCE, configurationSettings )
AvailableSettings.JPA_COMPLIANCE,
configurationSettings,
false
)
); );
} }

View File

@ -166,8 +166,7 @@ public class EmbeddableMappingTypeImpl extends AbstractEmbeddableMapping impleme
this.createEmptyCompositesEnabled = ConfigurationHelper.getBoolean( this.createEmptyCompositesEnabled = ConfigurationHelper.getBoolean(
Environment.CREATE_EMPTY_COMPOSITES_ENABLED, Environment.CREATE_EMPTY_COMPOSITES_ENABLED,
creationContext.getServiceRegistry().getService( ConfigurationService.class ).getSettings(), creationContext.getServiceRegistry().getService( ConfigurationService.class ).getSettings()
false
); );
final AggregateColumn aggregateColumn = bootDescriptor.getAggregateColumn(); final AggregateColumn aggregateColumn = bootDescriptor.getAggregateColumn();
if ( aggregateColumn != null ) { if ( aggregateColumn != null ) {

View File

@ -61,7 +61,7 @@ public class NamedQueryHelper {
cacheMode = cacheable ? determineCacheMode( hints, sessionFactory ) : null; cacheMode = cacheable ? determineCacheMode( hints, sessionFactory ) : null;
flushMode = determineFlushMode( hints, sessionFactory ); flushMode = determineFlushMode( hints, sessionFactory );
readOnly = ConfigurationHelper.getBoolean( HINT_READ_ONLY, hints, false ); readOnly = ConfigurationHelper.getBoolean( HINT_READ_ONLY, hints );
lockOptions = determineLockOptions( hints, sessionFactory ); lockOptions = determineLockOptions( hints, sessionFactory );
@ -152,7 +152,7 @@ public class NamedQueryHelper {
private static boolean isCacheable(Map<String, Object> hints, SessionFactoryImplementor sessionFactory) { private static boolean isCacheable(Map<String, Object> hints, SessionFactoryImplementor sessionFactory) {
return sessionFactory.getSessionFactoryOptions().isQueryCacheEnabled() return sessionFactory.getSessionFactoryOptions().isQueryCacheEnabled()
&& ConfigurationHelper.getBoolean( HINT_CACHEABLE, hints, false ); && ConfigurationHelper.getBoolean( HINT_CACHEABLE, hints );
} }
private static String determineCacheRegion(Map<String, Object> hints, SessionFactoryImplementor sessionFactory) { private static String determineCacheRegion(Map<String, Object> hints, SessionFactoryImplementor sessionFactory) {

View File

@ -29,8 +29,7 @@ public class ParameterMarkerStrategyInitiator implements StandardServiceInitiato
public ParameterMarkerStrategy initiateService(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) { public ParameterMarkerStrategy initiateService(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) {
final boolean useNativeMarkers = ConfigurationHelper.getBoolean( final boolean useNativeMarkers = ConfigurationHelper.getBoolean(
AvailableSettings.DIALECT_NATIVE_PARAM_MARKERS, AvailableSettings.DIALECT_NATIVE_PARAM_MARKERS,
configurationValues, configurationValues
false
); );
if ( useNativeMarkers ) { if ( useNativeMarkers ) {

View File

@ -47,7 +47,7 @@ public enum JdbcMetadaAccessStrategy {
if ( options == null ) { if ( options == null ) {
return interpretHbm2ddlSetting( null ); return interpretHbm2ddlSetting( null );
} }
else if ( ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, options, false ) ) { else if ( ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, options ) ) {
// Use of synonyms can cause issues during schema validation or schema update when GROUPED strategy is used (especially in Oracle) // Use of synonyms can cause issues during schema validation or schema update when GROUPED strategy is used (especially in Oracle)
return INDIVIDUALLY; return INDIVIDUALLY;
} }

View File

@ -104,7 +104,7 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
final List<String> tableTypesList = new ArrayList<>(); final List<String> tableTypesList = new ArrayList<>();
tableTypesList.add( "TABLE" ); tableTypesList.add( "TABLE" );
tableTypesList.add( "VIEW" ); tableTypesList.add( "VIEW" );
if ( ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, configService.getSettings(), false ) ) { if ( ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, configService.getSettings() ) ) {
if ( dialect instanceof DB2Dialect ) { if ( dialect instanceof DB2Dialect ) {
tableTypesList.add( "ALIAS" ); tableTypesList.add( "ALIAS" );
} }

View File

@ -162,8 +162,7 @@ public class Helper {
//Then try the Hibernate ORM setting: //Then try the Hibernate ORM setting:
ConfigurationHelper.getBoolean( ConfigurationHelper.getBoolean(
AvailableSettings.HBM2DDL_CREATE_NAMESPACES, AvailableSettings.HBM2DDL_CREATE_NAMESPACES,
configurationValues, configurationValues
false
) )
) )
); );
@ -172,8 +171,7 @@ public class Helper {
public static boolean interpretFormattingEnabled(Map<String,Object> configurationValues) { public static boolean interpretFormattingEnabled(Map<String,Object> configurationValues) {
return ConfigurationHelper.getBoolean( return ConfigurationHelper.getBoolean(
AvailableSettings.FORMAT_SQL, AvailableSettings.FORMAT_SQL,
configurationValues, configurationValues
false
); );
} }