OK, no takers so far. So how about I suggest a possible solution?
I'm thinking that instead of calling Session.delete(Object object) I could instead call Session.delete(String query) with a query of something like:
Code:
FROM employee WHERE employee.id = ? AND employee.version = ?
I can then check the return value of delete(String query) and throw an exception to indicate that the underlying object has been changed if no rows were deleted.
Clearly an update-related optimistic lock using versioning could be done in exactly the same way, but Hibernate provides a facility to hide the version check away, and I'm just wondering if there's a similar facility for delete-related optimistic locks.