Hibernate version: 2.1.8
Name and version of the database you are using: Oracle 9.2
All,
just stumbled over a truly strange problem:
Isolation mode "read committed" (which is the default for most databases, e.g. Oracle) means that new rows which have been inserted by other - previously concurrently running, but now committed - DB sessions may get visible during my own current DB session's lifetime.
So it has to be possible by definition of the isolation level "read committed" that an attempt to load an object with a given key which has failed when trying it for the first time in a current Hibernate Session can succeed when trying the same for a second time from the same Session, supposed that the object with the respective key has been inserted and committed in the meantime by a different session.
The problem here seems to be that the Hibernate SessionImpl manages a nonExists HashSet where it stores keys for which it "knows" that the respective objects have not been existing when this was tried for the last time (a somewhat strange idea anyway!?).
In our scenario, hitting the database directly using plain SQL from within the same DB connection/DB session will find and return the newly inserted row during the second try, while the Hibernate Session still fails to return it on get() or load(), because it will use the cached information from the first try and not be able detect that the newly inserted row - due to the "read committed" isolation mode - now has become visible.
Is there any known solution to/workaround for this? Should I proceed and file an issue?
Many thanks in advance,
Andreas
|