Hibernate version : latest
hello there,
i am writing code to ensure that when 2 users are deleting the same record at the same time, i want to be able to make sure that the second delete of the same record, which will definitely fail (cos the first delete will pass) is handled properly. I have tried LockMode.upgrade to prevent the second thread from getting a read on the same row that the first thread is deleting but the second thread still does, so that method is not working, i have also thought of catching any specific hibernateexception or jdbcexception(which gives the error code) which might indicate that the row the thread is trying to delete does not exist. but all i got was a generic hibernateexception which could mean anything. i also tried calling getCause() method hoping to get a more specific exception, but i got null instead. i am now out of options, is there anyone out there who have faced a similar situation and have found a clean solution to it using hibernate or another technique? Thanks
|