My application consumes remote REST API and populates local db with greenDao. I have a service with AsyncTask class:
@Override
protected Void doInBackground(Void... params) {
insert100RowsIntheFirstTable();
insert100RowsIntheSecondTable();
}
Inside each insert-method I have insertOrReplaceInTx, which I use primarily for performance gain.
What I need is to abandon results if any of the methods fails to retrieve data. It's supposed to be done through the same transaction.
I wonder if it's right to surround my insert-method calls with mDaoSession.callInTx(callable)
while having insertOrReplaceInTx
inside the methods. Am I right?
Additionally, how do I abandon transaction in case exception is raised - is it done automatically by means of greenDao ?