Return-Path: Delivered-To: apmail-incubator-ibatis-user-java-archive@www.apache.org Received: (qmail 55293 invoked from network); 9 Mar 2005 23:34:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 9 Mar 2005 23:34:23 -0000 Received: (qmail 67445 invoked by uid 500); 9 Mar 2005 23:34:23 -0000 Delivered-To: apmail-incubator-ibatis-user-java-archive@incubator.apache.org Received: (qmail 67429 invoked by uid 500); 9 Mar 2005 23:34:22 -0000 Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Precedence: bulk Reply-To: ibatis-user-java@incubator.apache.org List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list ibatis-user-java@incubator.apache.org Delivered-To: moderator for ibatis-user-java@incubator.apache.org Received: (qmail 81405 invoked by uid 99); 7 Mar 2005 15:14:35 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=HTML_MESSAGE,HTML_TEXT_AFTER_BODY,HTML_TEXT_AFTER_HTML X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) From: "Meindert" To: Subject: Update only when value is not null Date: Mon, 7 Mar 2005 17:12:40 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C52338.DF4A33D0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcUjKBn3are/8jJGRuKoBBTRP6G2zg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-ID: X-OriginalArrivalTime: 07 Mar 2005 15:14:30.0987 (UTC) FILETIME=[5CA469B0:01C52328] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C52338.DF4A33D0 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: quoted-printable Update only when value is not null (or =93=94 or 0) =20 Hi there, =20 I try to make iBatis do a update only if the propertie in my object = contains data How do I do this? =20 Example, I=92m receiving a XML file that may contain some column values that need = to get updated: 852 Dalton Claire =20 I parse this into an employee object and get this through to my update statement; UPDATE EmplMain SET Surname =3D #surname#, EmplName =3D #emplName#, = Nickname =3D #nickname#, =85=85 ucEMPassword =3D #ucEMPassword# WHERE Code =3D #code# =20 This will not work because it is attempting to store null values, and = even if it worked it would override my data! =20 So I would like to do something like SET Surname =3D IIF(#surname# is = null, Surname, #surname#) =20 Can this be done? =20 HYPERLINK "mailto:meindert@pastelebusiness.com"Meindert Hoving =20 --=20 No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.6.2 - Release Date: 3/4/2005 =20 ------=_NextPart_000_0000_01C52338.DF4A33D0 Content-Type: text/html; charset="windows-1250" Content-Transfer-Encoding: quoted-printable

Update only when value is not null (or “” = or 0)

 

Hi there,

 

I try to make iBatis do a update only if the = propertie in my object contains data

How do I do this?

 

Example,

I’m receiving a XML file that may contain some = column values that need to get updated:

<employees xmlns=3D'http://openuri.org/empschema' company=3D'1'>

  <employee>

     = <Code>852</Code>

     <Surname>Dalton</Surname>

     = <EmplName>Claire</EmplName>

  </employee>

</employees>

 

I parse this into an employee object and get this = through to my update statement;

<update id=3D"updateEmployeeDirect" parameterClass=3D"xmlemployee">

=

   UPDATE EmplMain SET Surname =3D = #surname#, EmplName =3D #emplName#, Nickname =3D = #nickname#,

         = ……

 ucEMPassword =3D = #ucEMPassword#

      WHERE Code =3D = #code#

  </update>

 

This will not work because it is attempting to store = null values, and even if it worked it would override my = data!

 

So I would like to do something like SET Surname =3D = IIF(#surname# is null, Surname, #surname#)

 

Can this be done?

 

Meindert = Hoving

 


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.6.2 - Release Date: 3/4/2005

------=_NextPart_000_0000_01C52338.DF4A33D0--