ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darek Dober" <doover...@op.pl>
Subject daoManager start/end/commit transaction problem
Date Thu, 04 Aug 2005 09:02:44 GMT
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


Mime
View raw message