Return-Path: Delivered-To: apmail-ibatis-dev-archive@www.apache.org Received: (qmail 669 invoked from network); 27 Sep 2007 19:59:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Sep 2007 19:59:12 -0000 Received: (qmail 57986 invoked by uid 500); 27 Sep 2007 19:59:02 -0000 Delivered-To: apmail-ibatis-dev-archive@ibatis.apache.org Received: (qmail 57834 invoked by uid 500); 27 Sep 2007 19:59:01 -0000 Mailing-List: contact dev-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ibatis.apache.org Delivered-To: mailing list dev@ibatis.apache.org Received: (qmail 57820 invoked by uid 99); 27 Sep 2007 19:59:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Sep 2007 12:59:01 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Sep 2007 19:59:10 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 96BE871403E for ; Thu, 27 Sep 2007 12:58:50 -0700 (PDT) Message-ID: <21546628.1190923130611.JavaMail.jira@brutus> Date: Thu, 27 Sep 2007 12:58:50 -0700 (PDT) From: "Peter Martin (JIRA)" To: dev@ibatis.apache.org Subject: [jira] Created: (IBATIS-461) nullValue not working for parameter map MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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: 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.