Consider the scenario: A Db transaction envolving more than one row from different tables with versioning.
For example: A shopLists and products. Where a shopList may contain products (with their amount in the shoplist) and products have their current stock.
When I insert ou edit a shopList, I want the stock of those products in the shopList to be updated to keep the stock consistant.
To do that, I open a transaction, insert/update the shopList, update the stocks for each product (apply delta) and then commit the transaction. No big deal up to now.
However, other user may have updated one or more products in common. Or even updated the shopList itself. In both cases, I would get a StaleObjectStateException when commiting the transaction.
Question is: Is there a way to determine which table caused the StaleObjectStateException?
In case the product caused the exception, I could refresh all envolved products from the DB and then reapply the stock deltas. And that's fine. In case the shopList caused the exception, it would be better to simply report the issue to the user so he could start over again.
Thanks very much for your help.