Thank you a lot. That´s a proper solution :-)
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Larry Meadors > Sent: Wednesday, October 31, 2007 3:48 PM > To: [email protected] > Subject: Re: Insert null > > 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 id="insertApplication" > parameterClass="de.dtrust.tk.ebxml.database.Application"> > 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# ) > </insert> > > 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 <[EMAIL PROTECTED]> 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 string. > > > > Should work. From documentation, under In-line parameter maps. > > http://ibatis.apache.org/docs/java/pdf/iBATIS-SqlMaps-2_en.pdf > > > > > > > > > > Härtel wrote: > > > Hello list, > > > > > > I want to insert null for a String/VARCHAR property. > Posting > http://www.mail-archive.com/[email protected]/msg050 > 79.html tells if my String 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 id="insertApplication" > parameterClass="de.dtrust.tk.ebxml.database.Application"> > > > INSERT INTO application ( degree, firstname, > name_prefix, name_affix, lastname, > > > address_1, address_2, address_3, > address_4, email) > > > VALUES ( #degree#, #firstname#, #namePrefix#, > #nameAffix#, #lastname#, > > > #address_1#, #address_2#, > #address_3#, #address_4#, #email# ) > > > </insert> > > > > > > If I put an empty String("") for the email it works. But > with null would be more comfortable. > > > Any suggestions? > > > > > > Gretings Eric > > > > > > > >
