|
What am I looking for in these documents?
There is no fix or workaround for this problem that the 'user code' can do to avoid this issue, other than setting some very high isolation levels or use pessimistic locks when querying. None of these is a meaningful solution. Returning some latest data and some old data will break most of the logical asserts about the resultset (for example, returned records cannot be trusted to obey uniqueness constraints enforced by the DB). This may cause serious problems for the applications that use Hibernate.
Any of the session-less ORMs are safe from such issues, why not change Hibernate so queries return consistent data too? Database engine is working hard (with default read-committed isolation level) to provide consistent data from selects. Why not try to preserve that consistency?
This is something that Hibernate could fix. The current behavior makes Hibernate simply a bad choice for any application that cares about concurrency. I strongly believe that many of the existing applications have serious concurrency issues because of this problem. Developers are simply not aware of this problem and even if they were, there is not much they could do other than write conservative code which does not exception when queries return inconsistent data.
If you cannot trust that City.findByName('petersburg') will give you city with name 'petersburg' and not something with some other name like 'leningrad' how can you write any bug free code?
Please reconsider and reopen this ticket.
|