HHH-11267 Fix BulkOperationsTest and ReadWriteTest
This commit is contained in:
parent
4508a9e654
commit
6aaaf37d6f
|
@ -75,7 +75,7 @@ public class XaConnectionProvider implements ConnectionProvider {
|
||||||
Connection connection = currentTransaction.getEnlistedConnection();
|
Connection connection = currentTransaction.getEnlistedConnection();
|
||||||
if ( connection == null ) {
|
if ( connection == null ) {
|
||||||
connection = actualConnectionProvider.getConnection();
|
connection = actualConnectionProvider.getConnection();
|
||||||
currentTransaction.enlistConnection( connection );
|
currentTransaction.enlistConnection( connection, actualConnectionProvider );
|
||||||
}
|
}
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ public class XaConnectionProvider implements ConnectionProvider {
|
||||||
|
|
||||||
public void closeConnection(Connection conn) throws SQLException {
|
public void closeConnection(Connection conn) throws SQLException {
|
||||||
if ( !isTransactional ) {
|
if ( !isTransactional ) {
|
||||||
conn.close();
|
actualConnectionProvider.closeConnection(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import javax.transaction.xa.XAResource;
|
||||||
import javax.transaction.xa.Xid;
|
import javax.transaction.xa.Xid;
|
||||||
|
|
||||||
import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
|
import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
|
||||||
|
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XaResourceCapableTransactionImpl.
|
* XaResourceCapableTransactionImpl.
|
||||||
|
@ -41,6 +42,7 @@ public class XaTransactionImpl implements Transaction {
|
||||||
private final XaTransactionManagerImpl jtaTransactionManager;
|
private final XaTransactionManagerImpl jtaTransactionManager;
|
||||||
private List<XAResource> enlistedResources = new ArrayList<XAResource>();
|
private List<XAResource> enlistedResources = new ArrayList<XAResource>();
|
||||||
private Xid xid = new XaResourceCapableTransactionXid();
|
private Xid xid = new XaResourceCapableTransactionXid();
|
||||||
|
private ConnectionProvider connectionProvider;
|
||||||
|
|
||||||
public XaTransactionImpl(XaTransactionManagerImpl jtaTransactionManager) {
|
public XaTransactionImpl(XaTransactionManagerImpl jtaTransactionManager) {
|
||||||
this.jtaTransactionManager = jtaTransactionManager;
|
this.jtaTransactionManager = jtaTransactionManager;
|
||||||
|
@ -84,7 +86,8 @@ public class XaTransactionImpl implements Transaction {
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
try {
|
try {
|
||||||
connection.commit();
|
connection.commit();
|
||||||
connection.close();
|
connectionProvider.closeConnection(connection);
|
||||||
|
connection = null;
|
||||||
} catch (SQLException sqle) {
|
} catch (SQLException sqle) {
|
||||||
status = Status.STATUS_UNKNOWN;
|
status = Status.STATUS_UNKNOWN;
|
||||||
throw new SystemException();
|
throw new SystemException();
|
||||||
|
@ -147,11 +150,12 @@ public class XaTransactionImpl implements Transaction {
|
||||||
synchronizations.add(synchronization);
|
synchronizations.add(synchronization);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enlistConnection(Connection connection) {
|
public void enlistConnection(Connection connection, ConnectionProvider connectionProvider) {
|
||||||
if (this.connection != null) {
|
if (this.connection != null) {
|
||||||
throw new IllegalStateException("Connection already registered");
|
throw new IllegalStateException("Connection already registered");
|
||||||
}
|
}
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
|
this.connectionProvider = connectionProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Connection getEnlistedConnection() {
|
public Connection getEnlistedConnection() {
|
||||||
|
|
Loading…
Reference in New Issue