Skip to content

Commit f50275a

Browse files
Meehdimbellade
authored andcommitted
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 HHH-19852 fix fomatting problem
1 parent 7de8e93 commit f50275a

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)