ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ingmar Lötzsch <iloetz...@asci-systemhaus.de>
Subject Re: <update> with parameterMap and parameterClass ?
Date Wed, 26 Nov 2008 12:35:49 GMT
> Could I use an <update> statement using a parameterMap and a 
> parameterClass ? How to use a parameterClass property?
> 
> Example:
> 
> <update id="update1" parameterMap="personMap" parameterClass="Person">
> 
> UPDATE Person SET name=?,lastname=? WHERE id = (how to reference the 
> value from parameter class Person here?)
> </update>

Hello Alejandro,

provide an instance of Person as parameter, witch contains the values to 
store.

<update id="update1" parameterClass="Person">
   UPDATE Person SET
     name = #name:VARCHAR#,
     lastname = #lastname:VARCHAR#
   WHERE id = #id:INTEGER#
</update>

Or put the name, lastname and id in the map with keys "name", "lastname" 
and "id".

<update id="update1" parameterClass="map">
   UPDATE Person SET
     name = #name:VARCHAR#,
     lastname = #lastname:VARCHAR#
   WHERE id = #id:INTEGER#
</update>

You don't need the parameterMap attribute.

Ingmar

Mime
View raw message