Hi Andrus,

Andrus Adamchik schrieb:

On Aug 13, 2009, at 12:36 PM, Andreas Hartmann wrote:


Of course I could commit the transaction each 1000 rows or so, but I'd rather commit the whole spreadsheet to the DB in a single transaction.

You can use user-defined transaction scope, then committing every 1000 rows will allow Java side garbage collection on them, while the entire spreadsheet will load atomically (unless of course your DB does not support ACID transactions, i.e. MySQL MyISAM and such) :

http://cayenne.apache.org/doc/understanding-transactions.html

thanks a lot, that works like a charm!

Also I should note that if you are not on Cayenne 3.0 yet, that has self-cleaning DataContexts, you will also need to replace a DataContext after each commit.

I'm using 3.0M6, but thanks for mentioning this.

-- Andreas


--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01

Reply via email to