Not long ago I bumped into a nice riddle. Let's have scenario:
1. call method A of Session Bean placed in EAR_1 - begin of transaction X
2 call method B of Session Bean placed in EAR_2 - change of datarow in database by stored procedure (setting that row to value "1" earlier it was "0")
3. recalculation of data in method A
4. call the same method B of Session Bean placed in EAR_2 - change of datarow in database by stored procedure (setting that row to value "0" now)
5 end of method A of Session Bean placed in EAR_1 - end of transaction X = commit
The question is: why, after commiting the transaction X, the datarow has value "1", not "0", as setting to "0" was the last operation on that row.
Tech specs:
Websphere 6.1, EJB 2.1, Database: Oracle 10, non-XA Oracle drivers, connection pool, all methods have TX_REQUIRED attributes, all transactions are container-managed.
When I set TX_NOTSUPPORTED transaction attribute of method A, the datarow has value "0" at the end - the right value.
Can anybody explain this strange behaviour ?