Currently, DataSourceUtils.resetConnectionAfterTransaction(…) queries the isReadOnly() state from the given JDBC Connection to disable read-only mode if isReadOnly() returns true. Ideally, the read-only state should be reset only if transaction attributes indicated to enable read-only mode (similar to isolation level and auto-commit).
Some JDBC drivers (e.g. H2) reach out to the database to query the state and we could skip this interaction.