Skip to content

Commit 4e4212b

Browse files
committed
Informix throws ClassCastException from incorrectly-implemented getObject()
so catch this too
1 parent 2c0af7e commit 4e4212b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/TimestampWithTimeZoneJdbcType.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected X doExtract(ResultSet rs, int position, WrapperOptions options) throws
132132
// supposed to be supported in JDBC 4.2
133133
return javaType.wrap( rs.getObject( position, OffsetDateTime.class ), options );
134134
}
135-
catch (SQLException|AbstractMethodError e) {
135+
catch (SQLException|AbstractMethodError|ClassCastException e) {
136136
// fall back to treating it as a JDBC Timestamp
137137
return options.getJdbcTimeZone() != null ?
138138
javaType.wrap( rs.getTimestamp( position, Calendar.getInstance( options.getJdbcTimeZone() ) ), options ) :
@@ -146,7 +146,7 @@ protected X doExtract(CallableStatement statement, int position, WrapperOptions
146146
// supposed to be supported in JDBC 4.2
147147
return javaType.wrap( statement.getObject( position, OffsetDateTime.class ), options );
148148
}
149-
catch (SQLException|AbstractMethodError e) {
149+
catch (SQLException|AbstractMethodError|ClassCastException e) {
150150
// fall back to treating it as a JDBC Timestamp
151151
return options.getJdbcTimeZone() != null ?
152152
javaType.wrap( statement.getTimestamp( position, Calendar.getInstance( options.getJdbcTimeZone() ) ), options ) :
@@ -160,7 +160,7 @@ protected X doExtract(CallableStatement statement, String name, WrapperOptions o
160160
// supposed to be supported in JDBC 4.2
161161
return javaType.wrap( statement.getObject( name, OffsetDateTime.class ), options );
162162
}
163-
catch (SQLException|AbstractMethodError e) {
163+
catch (SQLException|AbstractMethodError|ClassCastException e) {
164164
// fall back to treating it as a JDBC Timestamp
165165
return options.getJdbcTimeZone() != null ?
166166
javaType.wrap( statement.getTimestamp( name, Calendar.getInstance( options.getJdbcTimeZone() ) ), options ) :

0 commit comments

Comments
 (0)