ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Zurke <mis...@zurke.info>
Subject Re: dynamic update -> comma prob
Date Fri, 10 Jun 2005 16:10:11 GMT
sorry, can't find any info about the 'removeFirstPrepend' attribute in
the ibatis SQL Maps 2 documentation (downloaded the pdf today and it
covers only version 2.0).

btw: i could solve the prob by always updating the primary key - in that 
case the dynamic prepending will always work.

mish

Brandon Goodin wrote:
> Good question. If you place the tags inside the <dynamic> tag, the
> first content producing dyanmic tag will have it's prepend removed. If
> you have further nested tags you can use the removeFirstPrepend
> attribute as well. Both of these are documented in the SQL Maps PDF.
> 
> Brandon
> 
> On 6/9/05, Michael Zurke <mischa@zurke.info> wrote:
> 
>>ok, but what if name is not available and othername is?
>>
>>Brandon Goodin wrote:
>>
>>><update id="update" parameterClass="java.util.Map">
>>>      UPDATE public.master
>>>      SET
>>>      <isPropertyAvailable property="name">
>>>       name        = #name#
>>>      </isPropertyAvailable>
>>>      <isPropertyAvailable prepend="," property="othername">
>>>               othername   = #othername#
>>>      </isPropertyAvailable>
>>>        WHERE id = #id#
>>>    </update>
>>>
>>>On 6/9/05, Michael Zurke <mischa@zurke.info> wrote:
>>>
>>>
>>>>hi,
>>>>
>>>>i got the following statement:
>>>>
>>>><update id="update" parameterClass="java.util.Map">
>>>>      UPDATE public.master
>>>>      SET
>>>>      <isPropertyAvailable property="name">
>>>>       name        = #name#,
>>>>      </isPropertyAvailable>
>>>>      <isPropertyAvailable property="othername">
>>>>               othername   = #othername#
>>>>      </isPropertyAvailable>
>>>>        WHERE id = #id#
>>>>    </update>
>>>>
>>>>Now is there an easy way to get rid of the comma after #name# in case
>>>>that the property "othername# is not available? or do i have to check
>>>>if "othername" is set before setting the name field. for this example it
>>>>would be kind of ok but let's assume i do the same for lots of fields...err.
>>>>
>>>>any ideas?
>>>>
>>>>thanx,
>>>>mish
>>>>
>>>
>>>
>>
> 


Mime
View raw message