Requesting a nested transaction with a more restrictive isolation level appears to succeed, but does not have the requested effect
Description
Environment
Attachments
- 22 Jul 2015, 07:50 PM
Activity
Sean Corfield September 2, 2016 at 4:45 AM
I'd be happy for you to create an issue for that (and offer a patch if you get the time).
To partially address the request from the (java.jdbc) mailing list, I added a get-isolation-level
function so folks can at least tell if they're inside a transaction and what that current isolation level is (if known).
import August 30, 2016 at 7:58 PM
Comment made by: donald.ball
I never did get around to it, no sorry! Would you like it, or are you reconsidering the change in general? (I still feel the new behavior is more correct, but am curious if there's a use case I failed to consider.)
Sean Corfield August 30, 2016 at 5:15 PM
@UNKNOWN_USER This issue came up again recently (as a request to allow the old behavior), and I wondered if you ever created the issue for the incompatible read-only mode check? I don't see it...
Sean Corfield July 27, 2015 at 6:03 PM
Sure. Do you want to create a new ticket and attach a patch to it?
import July 27, 2015 at 2:38 PM
Comment made by: donald.ball
Would you be amenable to also raising if the inner transaction requests an incompatible read-only mode?
Details
Assignee
Sean CorfieldSean CorfieldReporter
importimportPatch
Code and TestPriority
Major
Details
Details
Assignee
Reporter
Patch
Priority

The library helpfully allows nested transactions by maintaining an internal depth counter, but silently disregards any transaction options for nested transactions. This has actually bitten me recently in production; code that required a serializable transaction in order to maintain an invariant was inadvertently being executed within a repeatable-read transaction.
This patch changes the behavior to raise if a nested transaction requests a different isolation level in which the actual transaction is running.
A similar problem exists for nested transactions that request read-only mode. I will be happy to modify the patch to cover that case if you are interested in accepting this.