- Common ways to obtain TransactionException
private void myMethod () {TransactionException t =
Object[] arguments;new TransactionException(ExceptionMessageGenerator.buildMessage(TransactionException.class, errorNumber, arguments))
TransactionException.externalTransactionNotActive()
UnitOfWorkImpl unitOfWork;TransactionException.inactiveUnitOfWork(unitOfWork)
- Smart code suggestions by Codota
}
public Connection getConnection(DataSourceImpl ds, String user, String password) throws SQLException { // We don't have a datasource connection yet, so allocate one if (connection == null) { debug("TxImpl - allocating new connection"); dataSource = ds; connection = ds.internalGetConnection(user, password); connection.setAutoCommit(false); } else { // We already have a connection. Make sure the data sources are the same. if (ds.getName() != dataSource.getName()) { throw TransactionException.multipleResourceException(); } } // return connection; // Allocate and return a proxy for the connection debug("TxImpl - creating connection proxy"); Connection proxyConnection = null; try { InvocationHandler handler = new ConnectionProxyHandler(connection); proxyConnection = (Connection)proxyClass.getConstructor(new Class[] { InvocationHandler.class }).newInstance(new Object[] { handler }); } catch (Exception ex) { throw TransactionException.internalProxyException(ex); } return proxyConnection; }