Description
Ionut Gradinaru opened SPR-14581 and commented
Spring JDBC uses StatementCreatorUtils to identify the mapping between Java data types and the SQL data types when persisting DOs using BeanPropertySqlParameterSource for DO to table mapping. The data type mappings are hard coded in StatementCreatorUtils and the following new mapping have been added starting from v 4.2.3:
javaTypeToSqlTypeMap.put(boolean.class, Types.BOOLEAN);
javaTypeToSqlTypeMap.put(Boolean.class, Types.BOOLEAN);
The Oracle JDBC driver does not know how to handle Types.BOOLEAN for the target DB column, so we get the ‘java.sql.SQLException: Invalid column type’ when trying to write a DO which has a boolean data member
To bypass this issue in the application domain, the hard coded data type map defined in StatementCreatorUtils may updated by removing the faulty mappings using reflection.
Please consider addressing this issue in the framework domain too.
Affects: 4.2.4
Issue Links:
- Java boolean is not handled correctly when used with Oracle JDBC driver [SPR-14116] #18688 Java boolean is not handled correctly when used with Oracle JDBC driver ("duplicates")
- JdbcTemplate should support JDBC 4.1 getObject(columnIndex, type) [SPR-11600] #16223 JdbcTemplate should support JDBC 4.1 getObject(columnIndex, type)