Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORMLite - CallBatchTasks() individually or once for all updates?

I'm using ORMLite on Android, and have 7 tables in which I need to create/update multiple entries.

I'm using the callBatchTasks() method on each of my dao's individually to do this at present, but I was wondering if it's possible/beneficial to just use one dao's callBatchTasks() to process all of the updates?

Would this speed up the process?

like image 676
Andrew Briggs Avatar asked Apr 24 '12 20:04

Andrew Briggs


1 Answers

Interesting question. With ORMLite under Android, all of the DAOs are using the same connection to the same database. So although it is a little gross looking, you can certainly use a single fooDao.callBatchTasks() call to update Foo, Bar, and Baz tables. That disables the auto-commit on the connection, applies whatever create/update calls you want to which ever tables, and then commits all of the changes at the end.

like image 99
Gray Avatar answered Oct 25 '22 22:10

Gray