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

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.

Andrus

Reply via email to