nullValue not working for parameter map ---------------------------------------
Key: IBATIS-461 URL: https://issues.apache.org/jira/browse/IBATIS-461 Project: iBatis for Java Issue Type: Bug Components: SQL Maps Affects Versions: 2.3.0 Reporter: Peter Martin I have trying to use nullValue on my parameter map and it won't work - it doesn't use the nullValue: <parameterMap id="getPeopleParameters" class="map"> <parameter property="result" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT" resultMap="personMap" /> <parameter property="0" javaType="string" jdbcType="VARCHAR" mode="IN" nullValue="%" /> </parameterMap> I took a look at the source code (BasicParameterMap.setParameter()) and the code was not clear to me: protected void setParameter(PreparedStatement ps, BasicParameterMapping mapping, Object[] parameters, int i) throws SQLException { Object value = parameters[i]; // Apply Null Value String nullValueString = mapping.getNullValue(); if (nullValueString != null) { TypeHandler handler = mapping.getTypeHandler(); if (handler.equals(value, nullValueString)) { value = null; } } ... } It doesn't appear to actually do anything with the null value. The line of code that is actually executed to set the parameter is as follows: if (jdbcType != JdbcTypeRegistry.UNKNOWN_TYPE) { ps.setNull(i + 1, jdbcType); I changed the first part of the method as follows, which now does what I expect: protected void setParameter(PreparedStatement ps, BasicParameterMapping mapping, Object[] parameters, int i) throws SQLException { Object value = parameters[i]; // Apply Null Value String nullValueString = mapping.getNullValue(); if (value == null && nullValueString != null) { value = nullValueString; } ... } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.