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: How to handle Insert and update of 1:N objects
Date Wed, 21 Mar 2007 11:36:05 GMT
No, there is not a way to do that automatically, you have to insert
(or update) the parent, then iterate through the child records in code
inserting (or updating) them.

Larry


On 3/21/07, daheri <erikpoker@hotmail.com> wrote:
> I've just started out with iBATIS and have not found any information on this
> subject anywhere.
> I have one javabean (ITEM) containing a list of other javabeans
> (ALTERNATIVE). I was hoping to handle everything through a ItemDAO.
>
> The iBATIS mapping for the selects works perfectly. Then I can create a
> couple of resultmaps and use the groupBy and the beans are populated like a
> charm.
>
> But when i now try to do the exact opposite it gets a bit difficult. Is
> there a way to create a insert which take the ITEM as a parameterclass and
> then inserts the ITEM in the database, then iterate through the list of
> ALTERNATIVE adding all those as well?
>
> Or do I have to create a new AlternativeDAO and handle the Alternatives
> seperatly?
>
> Thanks in advance for your help.
> --
> View this message in context: http://www.nabble.com/How-to-handle-Insert-and-update-of-1%3AN-objects-tf3439472.html#a9590312
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message