Fix RepositoryConnection.getIsolationLevel() returning null when isolation level is set #5494
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed issue where
RepositoryConnection#getIsolationLevel()was always returning null even when an isolation level was set viabegin(IsolationLevel).Root Cause:
SailRepositoryConnectionoverridesbegin(IsolationLevel)andbegin(TransactionSetting...)but doesn't callsetIsolationLevel()to update the AbstractRepositoryConnection'sisolationLevelfield that is returned bygetIsolationLevel().Solution: Modified both methods in SailRepositoryConnection to call
setIsolationLevel()before starting the transaction.Changes Made
SailRepositoryConnection.begin(IsolationLevel level)to callsetIsolationLevel(level)SailRepositoryConnection.begin(TransactionSetting... settings)to callsetIsolationLevel()for isolation level settingstestGetIsolationLevel_shouldReturnSetLevel- Tests explicit isolation level setting viabegin(IsolationLevel)testGetIsolationLevel_shouldReturnSetLevelFromTransactionSettings- Tests isolation level viabegin(TransactionSetting...)testGetIsolationLevel_shouldReturnDefaultLevelWhenNotExplicitlySet- Tests that default isolation level is returned whenbegin()is called without parameters (currently failing, demonstrates additional issue)Testing
begin()without parameters doesn't properly set isolation level)The fix is minimal and surgical - it only adds the missing
setIsolationLevel()call that should have been there. This ensures thatgetIsolationLevel()properly returns the isolation level that was set when beginning a transaction. The additional test case reveals that there's still an issue with the default isolation level behavior that may need to be addressed separately.Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.