Skip to content

Commit b3a27ef

Browse files
committed
Configuration.getBoolean() defaults to false, no need to pass it
1 parent b77893f commit b3a27ef

File tree

6 files changed

+17
-22
lines changed

6 files changed

+17
-22
lines changed

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SingleStoreDialect.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ private static SingleStoreTableType getTableType(DialectResolutionInfo info) {
235235
private static boolean getUpdateForEnabled(DialectResolutionInfo info) {
236236
return ConfigurationHelper.getBoolean(
237237
SINGLE_STORE_FOR_UPDATE_LOCK_ENABLED,
238-
info.getConfigurationValues(),
239-
false
238+
info.getConfigurationValues()
240239
);
241240
}
242241

hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public SessionFactoryOptionsBuilder(StandardServiceRegistry serviceRegistry, Boo
462462
connectionHandlingMode = interpretConnectionHandlingMode( settings, serviceRegistry );
463463

464464
connectionProviderDisablesAutoCommit =
465-
getBoolean( CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT, settings, false );
465+
getBoolean( CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT, settings );
466466

467467
commentsEnabled = getBoolean( USE_SQL_COMMENTS, settings );
468468

@@ -479,10 +479,9 @@ public SessionFactoryOptionsBuilder(StandardServiceRegistry serviceRegistry, Boo
479479

480480
criteriaValueHandlingMode = ValueHandlingMode.interpret( settings.get( CRITERIA_VALUE_HANDLING_MODE ) );
481481
criteriaCopyTreeEnabled = getBoolean( CRITERIA_COPY_TREE, settings, jpaBootstrap );
482-
criteriaPlanCacheEnabled = getBoolean( CRITERIA_PLAN_CACHE_ENABLED, settings, false );
482+
criteriaPlanCacheEnabled = getBoolean( CRITERIA_PLAN_CACHE_ENABLED, settings );
483483

484-
nativeJdbcParametersIgnored =
485-
getBoolean( NATIVE_IGNORE_JDBC_PARAMETERS, settings, false );
484+
nativeJdbcParametersIgnored = getBoolean( NATIVE_IGNORE_JDBC_PARAMETERS, settings );
486485

487486
// added the boolean parameter in case we want to define some form of "all" as discussed
488487
jpaCompliance = context.getJpaCompliance();
@@ -509,11 +508,9 @@ public SessionFactoryOptionsBuilder(StandardServiceRegistry serviceRegistry, Boo
509508
unownedAssociationTransientCheck =
510509
getBoolean( UNOWNED_ASSOCIATION_TRANSIENT_CHECK, settings, isJpaBootstrap() );
511510

512-
passProcedureParameterNames =
513-
getBoolean( QUERY_PASS_PROCEDURE_PARAMETER_NAMES, settings, false );
511+
passProcedureParameterNames = getBoolean( QUERY_PASS_PROCEDURE_PARAMETER_NAMES, settings );
514512

515-
preferJdbcDatetimeTypes =
516-
getBoolean( NATIVE_PREFER_JDBC_DATETIME_TYPES, settings, false );
513+
preferJdbcDatetimeTypes = getBoolean( NATIVE_PREFER_JDBC_DATETIME_TYPES, settings );
517514

518515
defaultSessionProperties = initializeDefaultSessionProperties( configurationService );
519516

hibernate-core/src/main/java/org/hibernate/dialect/MySQLServerConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static MySQLServerConfiguration fromDialectResolutionInfo(DialectResoluti
7676
bytesPerCharacter = getInt( MYSQL_BYTES_PER_CHARACTER, info.getConfigurationValues(), 4 );
7777
}
7878
if ( noBackslashEscapes == null ) {
79-
noBackslashEscapes = getBoolean( MYSQL_NO_BACKSLASH_ESCAPES, info.getConfigurationValues(), false );
79+
noBackslashEscapes = getBoolean( MYSQL_NO_BACKSLASH_ESCAPES, info.getConfigurationValues() );
8080
}
8181
return new MySQLServerConfiguration( bytesPerCharacter, noBackslashEscapes );
8282
}

hibernate-core/src/main/java/org/hibernate/dialect/OracleServerConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ public static OracleServerConfiguration fromDialectResolutionInfo(DialectResolut
8585

8686
// default to the dialect-specific configuration settings
8787
final Map<String, Object> configuration = info.getConfigurationValues();
88-
final boolean defaultExtended = getBoolean( ORACLE_EXTENDED_STRING_SIZE, configuration, false );
89-
final boolean defaultAutonomous = getBoolean( ORACLE_AUTONOMOUS_DATABASE, configuration, false );
90-
final boolean defaultContinuity = getBoolean( ORACLE_APPLICATION_CONTINUITY, configuration, false );
88+
final boolean defaultExtended = getBoolean( ORACLE_EXTENDED_STRING_SIZE, configuration );
89+
final boolean defaultAutonomous = getBoolean( ORACLE_AUTONOMOUS_DATABASE, configuration );
90+
final boolean defaultContinuity = getBoolean( ORACLE_APPLICATION_CONTINUITY, configuration );
9191

9292
boolean extended;
9393
boolean autonomous;

hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ public long getDefaultLobLength() {
206206
}
207207

208208
private static boolean isAnsiNull(DialectResolutionInfo info) {
209-
final DatabaseMetaData databaseMetaData = info.getDatabaseMetadata();
209+
final var databaseMetaData = info.getDatabaseMetadata();
210210
if ( databaseMetaData != null ) {
211211
try ( var statement = databaseMetaData.getConnection().createStatement() ) {
212-
final ResultSet resultSet = statement.executeQuery( "SELECT @@options" );
212+
final var resultSet = statement.executeQuery( "SELECT @@options" );
213213
if ( resultSet.next() ) {
214214
final byte[] optionBytes = resultSet.getBytes( 1 );
215215
// By trial and error, enabling and disabling ansinull revealed that this bit is the indicator
@@ -221,14 +221,14 @@ private static boolean isAnsiNull(DialectResolutionInfo info) {
221221
}
222222
}
223223
// default to the dialect-specific configuration setting
224-
return getBoolean( SYBASE_ANSI_NULL, info.getConfigurationValues(), false );
224+
return getBoolean( SYBASE_ANSI_NULL, info.getConfigurationValues() );
225225
}
226226

227227
private int pageSize(DialectResolutionInfo info) {
228-
final DatabaseMetaData databaseMetaData = info.getDatabaseMetadata();
228+
final var databaseMetaData = info.getDatabaseMetadata();
229229
if ( databaseMetaData != null ) {
230230
try ( var statement = databaseMetaData.getConnection().createStatement() ) {
231-
final ResultSet resultSet = statement.executeQuery( "SELECT @@maxpagesize" );
231+
final var resultSet = statement.executeQuery( "SELECT @@maxpagesize" );
232232
if ( resultSet.next() ) {
233233
return resultSet.getInt( 1 );
234234
}
@@ -296,8 +296,7 @@ public boolean supportsDistinctFromPredicate() {
296296
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
297297
super.contributeTypes( typeContributions, serviceRegistry );
298298

299-
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
300-
.getJdbcTypeRegistry();
299+
final var jdbcTypeRegistry = typeContributions.getTypeConfiguration().getJdbcTypeRegistry();
301300
jdbcTypeRegistry.addDescriptor( Types.BOOLEAN, TinyIntJdbcType.INSTANCE );
302301
jdbcTypeRegistry.addDescriptor( Types.TIMESTAMP_WITH_TIMEZONE, TimestampJdbcType.INSTANCE );
303302
}

hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ private static Map<String, Object> mergedIntegrationSettings(
263263
private static void ignoreFlushBeforeCompletion(MergedSettings mergedSettings) {
264264
// flush before completion validation
265265
final var config = mergedSettings.getConfigurationValues();
266-
if ( getBoolean( FLUSH_BEFORE_COMPLETION, config, false ) ) {
266+
if ( getBoolean( FLUSH_BEFORE_COMPLETION, config ) ) {
267267
JPA_LOGGER.definingFlushBeforeCompletionIgnoredInHem( FLUSH_BEFORE_COMPLETION );
268268
config.put( FLUSH_BEFORE_COMPLETION, String.valueOf(false) );
269269
}

0 commit comments

Comments
 (0)