Hi Everybody,
I'm working on a layered web application and I reached the save() step of a several request/response cycles.
During the 7 first steps the user is filling forms and the business layer perform business rules checking
upon those entries.
Just before saving all the data the user entered I need to verify at a business level that the data are still valid.
(I check their compatibility is still ok which involves several data access and tests in between)
To garantee these tests I would like to perform a pessimistic locking of several rows of several tables during the tests :
In the business object that save data, I plan to do something like :
lockRows(aideFinanciere); boolean testIsOk = check(aideFinanciere);// this method involves several //hibernate queries and transactions
if testIsOk { save(aideFinanciere); unlockRows(aideFinanciere); success=true; } else { success=false; ...
unlockRows(aideFinanciere); }
aideFinanciere is not a persistent object. It is aggregating the data that the user is submiting across several requests.
The lock period of time is less than 1 second range but is necessary to make sure that I can trust the tests.
Is it possible to lock the rows and tables involved in the tests with a pessimistic lock transaction
that would keep unclosed across several other transactions?
Should I implement a "pessimistic offline lock" or is it possible to have an online lock?
Thanks in advance,
Eric Manuguerra
PS : My Hibernate version is 2.1
I'm working with ORACLE 8 database
|