public TransactionManager createTransactionManager(Connection connection) { return new JdbcTransactionManager(connection, isAutoCommit()); }
public TransactionManager createTransactionManager(Connection connection) { return new JdbcTransactionManager(connection, isAutoCommit()); }
public TransactionManager createTransactionManager(Connection connection) { return new JdbcTransactionManager(connection, isAutoCommit()); }
public TransactionManager createTransactionManager(Connection connection) { return new JdbcTransactionManager(connection, isAutoCommit()); }
protected void unbind(ExecutionContext executionContext) { try { Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName()); if(connection != null) { TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName()); if(transactionManager == null) { throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'"); } try { if(!isAutoCommit()) { // If there's no termination error on the context, commit, otherwise rollback... if(executionContext.getTerminationError() == null) { transactionManager.commit(); } else { transactionManager.rollback(); } } } finally { executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName()); connection.close(); } } } catch (SQLException e) { throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e); } finally { executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName()); executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName()); } }
protected void unbind(ExecutionContext executionContext) { try { Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName()); if(connection != null) { TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName()); if(transactionManager == null) { throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'"); } try { if(!isAutoCommit()) { // If there's no termination error on the context, commit, otherwise rollback... if(executionContext.getTerminationError() == null) { transactionManager.commit(); } else { transactionManager.rollback(); } } } finally { executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName()); connection.close(); } } } catch (SQLException e) { throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e); } finally { executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName()); executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName()); } }
protected void unbind(ExecutionContext executionContext) { try { Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName()); if(connection != null) { TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName()); if(transactionManager == null) { throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'"); } try { if(!isAutoCommit()) { // If there's no termination error on the context, commit, otherwise rollback... if(executionContext.getTerminationError() == null) { transactionManager.commit(); } else { transactionManager.rollback(); } } } finally { executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName()); connection.close(); } } } catch (SQLException e) { throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e); } finally { executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName()); executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName()); } }
protected void unbind(ExecutionContext executionContext) { try { Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName()); if(connection != null) { TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName()); if(transactionManager == null) { throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'"); } try { if(!isAutoCommit()) { // If there's no termination error on the context, commit, otherwise rollback... if(executionContext.getTerminationError() == null) { transactionManager.commit(); } else { transactionManager.rollback(); } } } finally { executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName()); connection.close(); } } } catch (SQLException e) { throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e); } finally { executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName()); executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName()); } }