Hi all,
I have the following code.....
SongRequestPubSplit is a child of SongRequest. Based on a PubSplitId which is a
String passed in as input we find the SongRequestPubSplit object (PubSplitId is the PK of SongRequestPubSplit). Then we get the parent SongRequest. Now we modify both objects and then we create a transaction. Then we try to persist the SongRequest within the transaction. This code is throwing the following exception.....
However if we move the transaction to the beginning (meaning that we start the transaction before getting and updating these objects) then it works fine. Why is this happening? Does Hibernate not like it when objects are retrieved and modified outside of a TX and then tried to be persisted within?
The reason I want to only do the transaction at the end is for performance. I want to reduce the amount of deadlocks so I want to hold the lock for as short a time as possible.
Thanks in advance for any help.