borinquenkid commented on PR #16763:
URL: https://github.com/apache/grails-core/pull/16763#issuecomment-6513641722

   Rebased onto `8.0.x` and squashed.
   
   We have refactored outer session lifecycle handling in 
`executeWithNewSession` to use dedicated `OuterSessionLifecycleStrategy` 
implementations matching the isolation requirements of each scope:
   
   - **`ActiveTransactionOuterSessionStrategy`**: When an outer write 
transaction is active, the outer session is suspended and rebound symmetrically 
without disconnecting or unbinding holders early, preserving active transaction 
state and flushed changes.
   - **`NonTransactionalSynchronizationOuterSessionStrategy`**: In 
non-transactional scopes under active Spring synchronization (e.g. 
`PROPAGATION_SUPPORTS` or OSIV), the outer session eagerly primes its 
connection so that lazy loads inside the new session's transaction do not 
borrow the inner connection, unbinds the session holder during new session 
execution, and registers synchronization to disconnect the outer session both 
on suspension (when a nested `REQUIRED` transaction begins) and before 
completion prior to Spring JDBC connection cleanup.
   - **`DefaultOuterSessionStrategy`**: Handles outer sessions where 
synchronization is inactive by priming disconnected sessions and unbinding 
before the new session runs, restoring it upon completion.
   - **`TransactionResources`**: Abstracts Spring's 
`TransactionSynchronizationManager` interactions for full decoupling and 
testability.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to