ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wible, Thomas E" <Thomas.E.Wi...@mdnt.com>
Subject RE: Selective Update of fields depending on values in object
Date Thu, 16 Feb 2006 12:45:03 GMT
while my predecessor didn't grok the difference between $delimiter$ &
#delimiter#, he did come up with exactly what u r looking 4:
 
<sqlmap>
 
 <resultmap id='parameter' class='my.param.obj'>
    <result property='id'        column='id'> 
    <result property='name' column='name'>
    <result property='date'   column='date'>
    <result property='value'   column='value'>
...
 </resultmap>
 
<update id='updateParam' parameterClass='my.param.obj'>
    UPDATE paramTable SET
        <dynamic>
            <isNotNull prepend="," property="name">
                name = $name$
            </isNotNull>
            <isNotNull prepend="," property="date">
                date = $date$
            </isNotNull>
            <isNotNull prepend="," property="value">
                value= $value$
            </isNotNull>
        </dynamic>
    WHERE id = $id$
 </update>
 
when i've added columns, i've had to use the # delimiter, but the above
works just fine 4 me;-)

Mime
View raw message