ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nielsen ...@videone.dk>
Subject Re: Insert for Complex object
Date Tue, 11 Jan 2005 23:44:16 GMT
    Does anyone know how to iterate throug  inserts and updates ??
i havent seen it anywhere, and my schema requires this.. :(
maybe something like

(pseudo)

<insert id="insertMany" parameterClass="class1">
    INSERT INTO CLASS1_CLASS2_JOIN(CLASS1_KEY, CLASS2_KEY)
    VALUES(
    <iterate property="class2">
         #class1_key#, #class2.class2_key#   
      </iterate>
    )
</insert>

where 
CLASS1_CLASS2_JOIN
is a join table for class1 and class2, with keys, class1_key class2_key


any ideas ??


-----Original Message-----
From: Larry Meadors <larry.meadors@gmail.com>
Sent: Tuesday, 11. Jan 2005 21:47 +0100
To: ibatis-user-java@incubator.apache.org
Subject: Re: Insert for Complex object

Why not just use a loop or some other iteration technique? You are
talking about saving 3-4 lines of code per instance, which is not
terribly significant, IMO.


On Tue, 11 Jan 2005 18:17:21 +0000 (UTC), ibatis-new-user
<shilpa.pradhan@judiciary.state.nj.us> wrote:
> 
> Hi,
>    I understand that iBATIs 2.0.9 provides a simple way to map
ResultSet to
> Complex object. (e.g. Category has many Products
>                        and Products has Items)
> 
> My question is, Can we do same thing for INSERT also??
> e.g. If I want to insert Category object using StoredProcedure, what
will be
> the simplest way to do it in iBATIs?
> can we write a ParameterMap for this kind of object mapping?
> 
> any help is appreciated.
> Thanks,
> shilpa
> 
>

Mime
View raw message