Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 67946 invoked from network); 31 Oct 2007 14:48:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Oct 2007 14:48:21 -0000 Received: (qmail 5645 invoked by uid 500); 31 Oct 2007 14:48:00 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 5629 invoked by uid 500); 31 Oct 2007 14:48:00 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 5593 invoked by uid 99); 31 Oct 2007 14:47:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2007 07:47:59 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of larry.meadors@gmail.com designates 66.249.92.173 as permitted sender) Received: from [66.249.92.173] (HELO ug-out-1314.google.com) (66.249.92.173) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2007 14:48:00 +0000 Received: by ug-out-1314.google.com with SMTP id h2so343556ugf for ; Wed, 31 Oct 2007 07:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=Ule/0Akyjs9B0fGWH/aRqOU1UAGqRJwOwMbOrnf0iIE=; b=G4Ho6KKEwEZBi3GvQImod0TiLxsQvRzVH/K9BewQHcYyhrCgeB9aVXdEKO2FEYHH3bw+3qzCq7GHaubfpJ3NEqd5nz3S/s9rvwajmFEqps+aJeMUrY8wl2DpjNiXkTsmvxauKeA6UEd7xHXQNHPfRT3XY5BFuI+Q4eWcE4d6Yy0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=NSZn4NEA2t9B9BBAVtpRHs8WT1TiNY+BpwB3axNDlktykmN64AA8j56I7ssW12GoPnHhgQPEiZx0l1Ahp+6/gznIZ+svUmlrCHl3aBpAbcI/bXiIcAAnMHTyl9lmyBGkmQSQJ7z4IsjZdBIOq5y6OXFsCLyRsP5rs6fhDpppQTM= Received: by 10.66.225.17 with SMTP id x17mr1235506ugg.1193842058524; Wed, 31 Oct 2007 07:47:38 -0700 (PDT) Received: by 10.67.93.8 with HTTP; Wed, 31 Oct 2007 07:47:38 -0700 (PDT) Message-ID: Date: Wed, 31 Oct 2007 08:47:38 -0600 From: "Larry Meadors" Reply-To: lmeadors@apache.org Sender: larry.meadors@gmail.com To: user-java@ibatis.apache.org Subject: Re: Insert null In-Reply-To: <4728912E.20206@investoranalytics.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4728912E.20206@investoranalytics.com> X-Google-Sender-Auth: b64c36ab251f1049 X-Virus-Checked: Checked by ClamAV on apache.org Heh, OK, that confused me. :) Eric, I think what Lisa is saying is that you need to provide a hint as to the data type - this is required for null values in some JDBC drivers (Oracle, for instance). So, you want to make the variables look like this: INSERT INTO application ( degree, firstname, name_prefix, name_affix, lastname, address_1, address_2, address_3, address_4, email) VALUES ( #degree:VARCHAR#, #firstname:VARCHAR#, #namePrefix:VARCHAR#, #nameAffix:VARCHAR#, #lastname:VARCHAR#, #address_1:VARCHAR#, #address_2:VARCHAR#, #address_3:VARCHAR#, #address_4:VARCHAR#, #email:VARCHAR# ) The reason for the hint is that the API for setting null parameters on prepared statements looks like this: setNull(int parameterIndex, int sqlType), and without the ":VARCHAR", we don't know the type (I wonder if we could use reflection to make a more educated guess..). Larry On 10/31/07, Lisa Jenkins wrote: > If what you are saying is you want to pass null value to ibatis, try > substituting the null value with "" in the insert statement. > > #email:jdbcType:null value to substitue# On the null value to use part, > use "". iBatis will automatically substitute null values with empty stri= ng. > > Should work. From documentation, under In-line parameter maps. > http://ibatis.apache.org/docs/java/pdf/iBATIS-SqlMaps-2_en.pdf > > > > > H=E4rtel wrote: > > Hello list, > > > > I want to insert null for a String/VARCHAR property. Posting http://www= .mail-archive.com/user-java@ibatis.apache.org/msg05079.html tells if my Str= ing is null default is null is inserted in the table. But it works not this= way here. > > I got the following error message: > > --- The error occurred while applying a parameter map. > > --- Check the insertApplication-InlineParameterMap. > > --- Check the parameter mapping for the 'email' property. > > --- Cause: java.lang.NullPointerException > > > > The insert mapping: > > > > INSERT INTO application ( degree, firstname, name_prefix, name_af= fix, lastname, > > address_1, address_2, address_3, address_4, email= ) > > VALUES ( #degree#, #firstname#, #namePrefix#, #nameAffix#, #lastn= ame#, > > #address_1#, #address_2#, #address_3#, #address_4= #, #email# ) > > > > > > If I put an empty String("") for the email it works. But with null woul= d be more comfortable. > > Any suggestions? > > > > Gretings Eric > > > >