You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Paulo Neves <ig...@gmail.com> on 2005/06/22 20:43:06 UTC
Saving a list
Hi all,
I'm doing an application using iBatis.
My question is, is possible to save a list ?
Example:
business objs:
class Relation {
Integer relId;
String name;
}
class Contact {
Integer contactId;
String name;
...
List relationsList;
}
How can I save one contact that could have a relationsList with only
one step like
sqlMap.insert("addContact",contact);
and not
sqlMap.insert("addContact",contact);
for(int i=0;i,contact.relationsList.size();i++) {
sqlMap("addContactRelation",contact.relationsList.get(i));
}
Thanks,
Paulo
Re: Saving a list
Posted by Brandon Goodin <br...@gmail.com>.
1 line of code versus 4. Doesn't appear to be a big issue. Simply wrap
it in a transaction and have at it.
Brandon
On 6/22/05, Paulo Neves <ig...@gmail.com> wrote:
> Hi all,
>
> I'm doing an application using iBatis.
> My question is, is possible to save a list ?
>
> Example:
> business objs:
> class Relation {
> Integer relId;
> String name;
> }
>
>
> class Contact {
> Integer contactId;
> String name;
> ...
> List relationsList;
> }
>
> How can I save one contact that could have a relationsList with only
> one step like
>
> sqlMap.insert("addContact",contact);
>
> and not
>
> sqlMap.insert("addContact",contact);
> for(int i=0;i,contact.relationsList.size();i++) {
> sqlMap("addContactRelation",contact.relationsList.get(i));
> }
>
> Thanks,
> Paulo
>