HHH-7090 - Temporary session closing affects original session
This commit is contained in:
parent
38c4f02cea
commit
1877315ee3
|
@ -85,8 +85,8 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
|
|||
TransactionContext transactionContext) {
|
||||
this.transactionContext = transactionContext;
|
||||
this.jdbcCoordinator = new JdbcCoordinatorImpl( userSuppliedConnection, this );
|
||||
this.transactionEnvironment = transactionContext.getTransactionEnvironment();
|
||||
this.transactionFactory = this.transactionEnvironment.getTransactionFactory();
|
||||
this.transactionEnvironment = transactionContext.getTransactionEnvironment();
|
||||
this.transactionFactory = this.transactionEnvironment.getTransactionFactory();
|
||||
this.observers = new ArrayList<TransactionObserver>();
|
||||
this.synchronizationRegistry = new SynchronizationRegistryImpl();
|
||||
reset();
|
||||
|
@ -105,8 +105,8 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
|
|||
List<TransactionObserver> observers) {
|
||||
this.transactionContext = transactionContext;
|
||||
this.jdbcCoordinator = jdbcCoordinator;
|
||||
this.transactionEnvironment = transactionContext.getTransactionEnvironment();
|
||||
this.transactionFactory = this.transactionEnvironment.getTransactionFactory();
|
||||
this.transactionEnvironment = transactionContext.getTransactionEnvironment();
|
||||
this.transactionFactory = this.transactionEnvironment.getTransactionFactory();
|
||||
this.observers = observers;
|
||||
this.synchronizationRegistry = new SynchronizationRegistryImpl();
|
||||
reset();
|
||||
|
|
|
@ -236,13 +236,14 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
|||
this.flushBeforeCompletionEnabled = flushBeforeCompletionEnabled;
|
||||
|
||||
if ( transactionCoordinator == null ) {
|
||||
this.isTransactionCoordinatorShared = false;
|
||||
this.connectionReleaseMode = connectionReleaseMode;
|
||||
this.autoJoinTransactions = autoJoinTransactions;
|
||||
|
||||
this.transactionCoordinator = new TransactionCoordinatorImpl( connection, this );
|
||||
this.transactionCoordinator.getJdbcCoordinator().getLogicalConnection().addObserver(
|
||||
new ConnectionObserverStatsBridge( factory )
|
||||
);
|
||||
this.isTransactionCoordinatorShared = false;
|
||||
this.connectionReleaseMode = connectionReleaseMode;
|
||||
this.autoJoinTransactions = autoJoinTransactions;
|
||||
}
|
||||
else {
|
||||
if ( connection != null ) {
|
||||
|
|
|
@ -218,7 +218,7 @@ public class AggressiveReleaseTest extends ConnectionManagementTestCase {
|
|||
Session s = getSessionUnderTest();
|
||||
s.beginTransaction();
|
||||
|
||||
List entities = new ArrayList();
|
||||
List<Silly> entities = new ArrayList<Silly>();
|
||||
for ( int i = 0; i < 10; i++ ) {
|
||||
Other other = new Other( "other-" + i );
|
||||
Silly silly = new Silly( "silly-" + i, other );
|
||||
|
@ -227,9 +227,7 @@ public class AggressiveReleaseTest extends ConnectionManagementTestCase {
|
|||
}
|
||||
s.flush();
|
||||
|
||||
Iterator itr = entities.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Silly silly = ( Silly ) itr.next();
|
||||
for ( Silly silly : entities ) {
|
||||
silly.setName( "new-" + silly.getName() );
|
||||
silly.getOther().setName( "new-" + silly.getOther().getName() );
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<class name="Silly">
|
||||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
<property name="name"/>
|
||||
<many-to-one name="other" class="Other" cascade="all"/>
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
<class name="Other">
|
||||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
<property name="name"/>
|
||||
</class>
|
||||
|
|
Loading…
Reference in New Issue