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.preferUserTransaction = getBoolean( PREFER_USER_TRANSACTION, configurationSettings, false );
this.preferUserTransaction = getBoolean( PREFER_USER_TRANSACTION, configurationSettings );
this.allowOutOfTransactionUpdateOperations = getBoolean(
ALLOW_UPDATE_OUTSIDE_TRANSACTION,
configurationSettings,
false
configurationSettings
);
this.releaseResourcesOnCloseEnabled = getBoolean(
DISCARD_PC_ON_CLOSE,
configurationSettings,
false
configurationSettings
);
Object jdbcTimeZoneValue = configurationSettings.get(
@ -556,8 +554,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.failOnPaginationOverCollectionFetchEnabled = getBoolean(
FAIL_ON_PAGINATION_OVER_COLLECTION_FETCH,
configurationSettings,
false
configurationSettings
);
this.immutableEntityUpdateQueryHandlingMode = ImmutableEntityUpdateQueryHandlingMode.interpret(
@ -569,8 +566,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.inClauseParameterPaddingEnabled = getBoolean(
IN_CLAUSE_PARAMETER_PADDING,
configurationSettings,
false
configurationSettings
);
this.queryStatisticsMaxSize = getInt(

View File

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

View File

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

View File

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

View File

@ -487,7 +487,7 @@ public class TableGenerator implements PersistentIdentifierGenerator {
* @return The default segment value to use.
*/
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;
LOG.usingDefaultIdGeneratorSegmentValue( qualifiedTableName.render(), segmentColumnName, defaultToUse );
return defaultToUse;

View File

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

View File

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

View File

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

View File

@ -61,7 +61,7 @@ public class NamedQueryHelper {
cacheMode = cacheable ? determineCacheMode( hints, sessionFactory ) : null;
flushMode = determineFlushMode( hints, sessionFactory );
readOnly = ConfigurationHelper.getBoolean( HINT_READ_ONLY, hints, false );
readOnly = ConfigurationHelper.getBoolean( HINT_READ_ONLY, hints );
lockOptions = determineLockOptions( hints, sessionFactory );
@ -152,7 +152,7 @@ public class NamedQueryHelper {
private static boolean isCacheable(Map<String, Object> hints, SessionFactoryImplementor sessionFactory) {
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) {

View File

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

View File

@ -47,7 +47,7 @@ public enum JdbcMetadaAccessStrategy {
if ( options == 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)
return INDIVIDUALLY;
}

View File

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

View File

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