-
Feature Request
-
Resolution: Unresolved
-
Minor
-
2.7
-
None
-
None
-
False
-
-
False
In 2.7 has been release the feature AG-255 with this changes
We have found a issue when we are working in a spring boot application with custom isolation level enabled and any Spring JDBC repository, as SimpleJpaRepository, because they are annotated with @Transactional( read-only=true) and when we upgraded to 2.7 version the SQLExceptin "Attempted to modify read-only state while enlisted in transaction" is always raised.
Detailed description:
When you are using springboot and enable custom isolation level by default spring use IsolationLevelDataSourceAdapter. As you can see the method doGetConnection(..)

First of all, retrieve the connection. Inside retrieve connection logic, in a moment of the process, the class NarayanaTransactionIntegration takes the control and it associates the current transaction to the connection.

A the ending of association process, the transaction is started using ConnectionHandler and this sets enlist attribute to true.

And finally, finish the retrieve connection process and IsolationLevelDataSourceAdapter continues retrieving the read-only value of current transaction. If this one is read-only, the code try to set read-only value to the connection in ConnectionWrapper:

In the second line handler try to verify Read-only attribute and
enlisted attribute is always true because the retrieve connection proces previously set it to true.