ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Meindert" <meind...@pastelebusiness.com>
Subject Update only when value is not null
Date Mon, 07 Mar 2005 15:12:40 GMT
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

How do I do this?



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

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








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

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

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


 ucEMPassword = #ucEMPassword#

      WHERE Code = #code#



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 = IIF(#surname# is null,
Surname, #surname#)


Can this be done?


HYPERLINK "mailto:meindert@pastelebusiness.com"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

View raw message