Hi Michael,

thanks, I do it this way as well and it's ok (~ 10k), but I was
wondering if there was a batch-insert. Just a thought - let's say:

instead of:

        SelectQuery sel2 = new SelectQuery(OrgIncome.class);
        List<OrgIncome> incomes = ctx.performQuery(sel2);
        for (OrgIncome oi : incomes) {
            Payment p = ctx.newObject(Payment.class);
            p.setAmount(oi.getAmount().doubleValue());
            p.setDate(oi.getDate());
            p.setNote(oi.getInfo());
            p.setVariableSymbol("" + oi.getVs());
        }
        ctx.commitChanges();

you would use something like:

        SelectQuery sel2 = new SelectQuery(OrgIncome.class);
        List<OrgIncome> incomes = ctx.performQuery(sel2);
        BatchInsertWrapper<OrgIncome> biw = new
BatchInsertWrapper<>(incomes);
        biw.commitTo(ctx);

with some optimizations for mass inserts inside.

Regards,

On 05/05/2010 10:58 PM, Michael Gentry wrote:
> Hi Marek,
>
> I don't know how many objects you are talking about inserting, but
> I've done mass inserts (tens to thousands of objects) just using
> dataContext.commitChanges().
>
> mrg
>
>
> On Wed, May 5, 2010 at 4:55 PM, Marek Šabo <ms...@buk.cvut.cz> wrote:
>   
>> I've been searching for a method to persist list of DataObjects aka
>> batch insert or mass insert. Haven't found anything relevant so far. Is
>> there a support for this in cayenne or some optimized way to this?
>> (faster than iterating and single inserting)
>>
>>     
>   


-- 
Marek Šabo
Server Manager
Club SU CVUT Buben
Bubenečská Kolej (421)
XMPP: zeratul...@gmail.com

Reply via email to