ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Maves" <nathan.ma...@gmail.com>
Subject Re: Batch Inserts and <selectKey />
Date Thu, 03 Jan 2008 03:02:19 GMT
we in my dao layer I would have something like...
psudeo {
  batch insert the 100 partents

  foreach(parent) {
    batch the 100 children;
    collection = queryForList("getChildren",parentId);
  }
}

On Jan 2, 2008 5:55 PM, Gregg Bolinger <gdboling.ibatis@gmail.com> wrote:

> Well, the problem is that I need them for a parent child relationship.
> Are there any known solutions?
>
> So say I batch insert 100 parents.  And then I need to batch insert 100
> children for each parent.  What is the best way to achieve this?
>
> Thanks.
>
> Gregg
>
>
> On Jan 2, 2008 6:37 PM, Nathan Maves <nathan.maves@gmail.com> wrote:
>
> > Gregg,
> > The underlyng call is to http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#executeBatch()
> >
> > <http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#executeBatch%28%29>which
as you can see from the javadocs only returns the number of effected
> > rows.
> >
> > I don't know of any way that would allow you to return the ids for each
> > batched insert with the current java.sql api's.
> >
> >
> > Nathan
> >
> >
> > On Jan 2, 2008 4:56 PM, Gregg Bolinger < gdboling.ibatis@gmail.com>
> > wrote:
> >
> > > If doing a batch insert on several objects I can't seem to retrieve
> > > the auto_increment key using the <selectKey /> tag.  Individual inserts
work
> > > just fine.  Is this expected?
> > >
> > > Thanks.
> > >
> > > Gregg
> > >
> >
> >
>

Mime
View raw message