metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kasper Sørensen <i.am.kasper.soren...@gmail.com>
Subject Re: Batch insert using Apache metamodel
Date Fri, 05 Feb 2016 06:30:43 GMT
That looks correct. You're inserting it in one go.
Consider BatchUpdateScript instead of UpdateScript if it's just a big bulk
like this.
Den 05/02/2016 5.23 AM skrev "Arunkumar Pillai" <arunkumar1111@gmail.com>:

> Hi
> PFB my code snippet
>
> dataContext.executeUpdate(new UpdateScript() {
>
>         def run(callback: UpdateCallback): Unit = {
>
>
>           val table: Table = schema.getTableByName(tablename)
>
>          for(i =1;i< n ;i ++){
>           callback.insertInto(table).value(columns, value)
>             .value(column, value)
>             .execute()
>         }
> }
>       }
>       )
>
> On Fri, Feb 5, 2016 at 12:23 AM, Kasper Sørensen <
> i.am.kasper.sorensen@gmail.com> wrote:
>
> > Hi Arun,
> >
> > It depends on where your loop is... Can you share a code snippet?
> >
> > Basically the loop should be inside an UpdateScript - then everything is
> > happening in one big bulk/transaction. If the loop is outside then you're
> > likely to suffer under a very chatty (and non-transactional) interaction
> > with the DB.
> >
> > Kasper
> >
> > 2016-02-04 5:22 GMT+01:00 Arunkumar Pillai <arunkumar1111@gmail.com>:
> >
> > > Hi
> > >
> > > Do we have any better way to insert multiple records together. current
> > i'm
> > > using loop?
> > > Please suggest if there any better ways
> > >
> > > --
> > > Thanks and Regards
> > >         Arun
> > >
> >
>
>
>
> --
> Thanks and Regards
>         Arun
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message