Hi
I use petstore as example so I have:
affairService and debtorService which gives me method like
updateAffair(Domain affair) and updateDebtor(Domain debtor)
Now I want them to be executed in one transaction
I try to do something like this
update() {
...
try {
affairService.getDaoManager().startTransaction();
affairService.updateAffair(affair);
debtorService.updateDebtor(debtor);
affairService.getDaoManager().commitTransaction();
} catch (Exception ex) {
..
} finally {
affairService.getDaoManager().endTransaction();
}
But after that operation i have some locks in database.
Is this the correct way, or should I use start/commit/endTransaction()
method at the lower level of ...sqlMapDao (i.e affairSqlMapDao)
Or maybe I should do it in pairs like:
affairService.getDaoManager().startTransaction();
debtorService.getDaoManager().startTransaction();
..
affairService.getDaoManager().commitTransaction();
debtorService.getDaoManager().commitTransaction();
Darek Dober