I got one session bean responsible for registering and then calculations of transactions. When I fire the calculation, they can last up to 2 mins, updating customers balances. If within this timeframe customer will register another transaction, his balance is not updated by the values from calculation. This is so frustrating... I checked some materials over internet, books but I can't find the point to start. Earlier, I've been using
EJB 2.1, which worked fine, but was very resource-consuming - blocked the customer balance table. Even stranger to me is the fact, that when I do those calculations, balance table is not updated (if customer reg. new transaction within timeframe), but another table when I insert info about calculation made works fine.
Trying to solve this problem, I added Thread.sleep(60000) to my calculation method (at the end) and tried to register new transaction myself. New transaction registration did not proceed until sleep finished (in another session, this is web app). I can't understand why it did not take updated balance if was waiting for finish of calculations anyway.
Any way to solve this nice way? Fx to force refresh of data during registration (i tried Entity Manager methods refresh, flush - no luck)?