Hi Ronery Coder,
I haven't had a time to look at your code yet, but any tests are very match appreciated, of course.
In a meantime, here are my 2c on your report from the implementer point of view:
#1,2 Absence of the phenomena at particular level does not mean that
implementation is wrong, just MAYBE inefficient. In case of H2,
multi-version nature of it allows for a cheap snapshot (at the start of a
transaction for REPEATABLE_READ, or at the start of a SQL statement for
READ_COMMITTED), which would indeed prevent any "phantom read". If you
can come up with implementation, which would benefit from allowing
phantom reads, your patch is welcome.
#3 As you said, "This should probably be fixed at the Spring level."
#4
It is correct In NON_REPEATABLE_READ mode, because T1 updated X, so T2
may see at different times (diferent statements with tx) committed value
of X, or previous one. Since transactions are concurrent, T2's read may
be not repeatable.
In READ_COMMITTED mode your scenario should cause NO exceptions.
But
In any case, it's not a deadlock. For a deadlock you need at least two
records to be updated by T1 and T2 in different order. It you have an
example of a deadlock exception in a different scenario, please let me
know.