ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: Insert on 1:M or N:M relation
Date Mon, 26 Jun 2006 08:39:03 GMT
You are correct, there is no API to do that out-of-the-box.

It's easy to build however:

start a transaction
insert parent
get inserted id
optional: start batch
step through child records, set parent id, and insert
optional: execute batch
commit transaction

Done. :-)


On 6/25/06, Nicolas Duroc <nicolas.duroc@gmail.com> wrote:
> Hi,
> I have in my database Schema 1:M or N:M relations. I've seen in the
> "Developer Guide" a solution for resolve Select on those cases, to fill all
> the object properties (particularly the Lists), I tried and it works great !
> I would like to know if there is a similar solution for insert (an object
> with a List property as parameter) which would fill the "principal" table
> from the object, and the "linked" table from the List of the object. I think
> a such mecanism doesn't exist, and a stored procedure will be the solution,
> but I would like to be sure.
> Thanks in advance
> Regards,
> Nicolas Duroc

View raw message