Skip to content

Commit c955150

Browse files
committed
minor code cleanups
Signed-off-by: Gavin King <[email protected]>
1 parent 88bdfbf commit c955150

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ public void setBootstrapContext(BootstrapContext bootstrapContext) {
10021002

10031003
private static TimeZoneStorageType resolveTimeZoneStorageStrategy(
10041004
ConfigurationService configService) {
1005-
return configService.getSetting(
1005+
return configService.getSetting(
10061006
AvailableSettings.TIMEZONE_DEFAULT_STORAGE,
10071007
value -> TimeZoneStorageType.valueOf( value.toString() ),
10081008
TimeZoneStorageType.DEFAULT
@@ -1017,7 +1017,7 @@ private static WrapperArrayHandling resolveWrapperArrayHandling(
10171017
WRAPPER_ARRAY_HANDLING,
10181018
WrapperArrayHandling::interpretExternalSettingLeniently
10191019
),
1020-
() -> resolveFallbackWrapperArrayHandling( configService, serviceRegistry )
1020+
() -> resolveFallbackWrapperArrayHandling( configService )
10211021
);
10221022

10231023
if ( setting == WrapperArrayHandling.PICK ) {
@@ -1035,9 +1035,8 @@ private static WrapperArrayHandling resolveWrapperArrayHandling(
10351035
};
10361036

10371037
private static WrapperArrayHandling resolveFallbackWrapperArrayHandling(
1038-
ConfigurationService configService,
1039-
StandardServiceRegistry serviceRegistry) {
1040-
if ( configService.getSetting( JPA_COMPLIANCE, BOOLEAN ) == Boolean.TRUE ) {
1038+
ConfigurationService configService) {
1039+
if ( configService.getSetting( JPA_COMPLIANCE, BOOLEAN, false ) ) {
10411040
// JPA compliance was enabled. Use PICK
10421041
return WrapperArrayHandling.PICK;
10431042
}

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126

127127
import jakarta.persistence.TemporalType;
128128

129+
import static org.hibernate.dialect.HANAServerConfiguration.MAX_LOB_PREFETCH_SIZE_DEFAULT_VALUE;
129130
import static org.hibernate.query.sqm.produce.function.FunctionParameterType.ANY;
130131
import static org.hibernate.type.SqlTypes.BINARY;
131132
import static org.hibernate.type.SqlTypes.BOOLEAN;
@@ -1763,7 +1764,7 @@ private X extract(NClob nclob, WrapperOptions options) throws SQLException {
17631764
if ( nclob == null ) {
17641765
return null;
17651766
}
1766-
if ( nclob.length() < HANANClobJdbcType.this.maxLobPrefetchSize ) {
1767+
if ( nclob.length() < maxLobPrefetchSize ) {
17671768
X retVal = javaType.wrap(nclob, options);
17681769
nclob.free();
17691770
return retVal;
@@ -1790,14 +1791,14 @@ protected X doExtract(CallableStatement statement, String name, WrapperOptions o
17901791
}
17911792

17921793
public int getMaxLobPrefetchSize() {
1793-
return this.maxLobPrefetchSize;
1794+
return maxLobPrefetchSize;
17941795
}
17951796
}
17961797

17971798
public static class HANABlobType implements JdbcType {
17981799

17991800
private static final long serialVersionUID = 5874441715643764323L;
1800-
public static final JdbcType INSTANCE = new HANABlobType( HANAServerConfiguration.MAX_LOB_PREFETCH_SIZE_DEFAULT_VALUE );
1801+
public static final JdbcType INSTANCE = new HANABlobType( MAX_LOB_PREFETCH_SIZE_DEFAULT_VALUE );
18011802

18021803
final int maxLobPrefetchSize;
18031804

@@ -1815,7 +1816,7 @@ public int getJdbcTypeCode() {
18151816

18161817
@Override
18171818
public String getFriendlyName() {
1818-
return "BLOB (hana)";
1819+
return "BLOB (HANA)";
18191820
}
18201821

18211822
@Override
@@ -1830,7 +1831,7 @@ private X extract(Blob blob, WrapperOptions options) throws SQLException {
18301831
if ( blob == null ) {
18311832
return null;
18321833
}
1833-
if (blob.length() < HANABlobType.this.maxLobPrefetchSize ) {
1834+
if ( blob.length() < maxLobPrefetchSize ) {
18341835
X retVal = javaType.wrap(blob, options);
18351836
blob.free();
18361837
return retVal;
@@ -1868,7 +1869,7 @@ protected void doBind(PreparedStatement st, X value, int index, WrapperOptions o
18681869
descriptor = BlobJdbcType.PRIMITIVE_ARRAY_BINDING;
18691870
}
18701871
else if ( options.useStreamForLobBinding() ) {
1871-
descriptor = HANABlobType.this.hanaStreamBlobTypeDescriptor;
1872+
descriptor = hanaStreamBlobTypeDescriptor;
18721873
}
18731874
descriptor.getBinder( javaType ).bind( st, value, index, options );
18741875
}
@@ -1881,15 +1882,15 @@ protected void doBind(CallableStatement st, X value, String name, WrapperOptions
18811882
descriptor = BlobJdbcType.PRIMITIVE_ARRAY_BINDING;
18821883
}
18831884
else if ( options.useStreamForLobBinding() ) {
1884-
descriptor = HANABlobType.this.hanaStreamBlobTypeDescriptor;
1885+
descriptor = hanaStreamBlobTypeDescriptor;
18851886
}
18861887
descriptor.getBinder( javaType ).bind( st, value, name, options );
18871888
}
18881889
};
18891890
}
18901891

18911892
public int getMaxLobPrefetchSize() {
1892-
return this.maxLobPrefetchSize;
1893+
return maxLobPrefetchSize;
18931894
}
18941895
}
18951896

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -895,17 +895,9 @@ public void contributeTypes(TypeContributions typeContributions, ServiceRegistry
895895

896896
// account for Oracle's deprecated support for LONGVARBINARY
897897
// prefer BLOB, unless the user explicitly opts out
898-
boolean preferLong = serviceRegistry.requireService( ConfigurationService.class ).getSetting(
899-
PREFER_LONG_RAW,
900-
StandardConverters.BOOLEAN,
901-
false
902-
);
903-
904-
BlobJdbcType descriptor = preferLong ?
905-
BlobJdbcType.PRIMITIVE_ARRAY_BINDING :
906-
BlobJdbcType.DEFAULT;
907-
908-
typeContributions.contributeJdbcType( descriptor );
898+
final boolean preferLong = serviceRegistry.requireService( ConfigurationService.class )
899+
.getSetting( PREFER_LONG_RAW, StandardConverters.BOOLEAN, false );
900+
typeContributions.contributeJdbcType( preferLong ? BlobJdbcType.PRIMITIVE_ARRAY_BINDING : BlobJdbcType.DEFAULT );
909901

910902
if ( getVersion().isSameOrAfter( 21 ) ) {
911903
typeContributions.contributeJdbcType( OracleJsonJdbcType.INSTANCE );

0 commit comments

Comments
 (0)