Skip to content

Commit 06fdba0

Browse files
committed
HHH-19852 Replace exception-based MAX_STRING_SIZE detection with direct query
Query database_properties view directly instead of attempting a varchar2(32000) cast to determine if MAX_STRING_SIZE is EXTENDED. HHH-19852 fix condition
1 parent 04ec9c6 commit 06fdba0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,13 @@ public static OracleServerConfiguration fromDialectResolutionInfo(DialectResolut
132132
}
133133

134134
private static boolean isExtended(Statement statement) {
135-
try ( final ResultSet resultSet =
136-
statement.executeQuery( "select cast('string' as varchar2(32000)) from dual" ) ) {
137-
resultSet.next();
138-
// succeeded, so MAX_STRING_SIZE == EXTENDED
139-
return true;
135+
try (final ResultSet resultSet =
136+
statement.executeQuery("SELECT property_value FROM database_properties " +
137+
"WHERE property_name = 'MAX_STRING_SIZE'")) {
138+
return resultSet.next()
139+
&& "EXTENDED".equalsIgnoreCase(resultSet.getString(1));
140140
}
141141
catch (SQLException ex) {
142-
// failed, so MAX_STRING_SIZE == STANDARD, still need to check autonomous
143142
return false;
144143
}
145144
}

0 commit comments

Comments
 (0)