@Override public void rollback(Savepoint savepoint) throws SQLException { throw new TransactionException( "Rollback cannot be called for a Transactional Connection"); }
@Override public void rollback() throws IllegalStateException, SystemException { throw new TransactionException("Open scoped transactions are not supported"); } }
@Override public Savepoint setSavepoint(String name) throws SQLException { throw new TransactionException( "Savepoints are not available for a Transactional Connection"); }
@Override public void commit() throws HeuristicMixedException, HeuristicRollbackException, RollbackException, SecurityException, SystemException { throw new TransactionException("Open scoped transactions are not supported"); }
@Override public void rollback() throws SQLException { throw new TransactionException( "Rollback cannot be called for a Transactional Connection"); }
@Override public Savepoint setSavepoint() throws SQLException { throw new TransactionException( "Savepoints are not available for a Transactional Connection"); }
@Override protected void commitTransaction_impl() throws Exception { throw new TransactionException("Open scoped transactions are not supported"); }
@Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { throw new TransactionException( "Savepoints are not available for a Transactional Connection"); }
private void checkEnlistment(boolean xaEnabled, boolean localEnabled, boolean isXA) { if (!xaEnabled && !localEnabled) { throw new TransactionException("The configuration supports neither local nor XA transactions"); } if(xaEnabled && !isXA) { throw new TransactionException("The configuration is XA enabled but the resource is not suitable for XA enlistment"); } } }
@Override public void setAutoCommit(boolean autoCommit) throws SQLException { throw new TransactionException( "Auto-commit cannot be changed for a Transactional Connection"); }
@Override public void rollback() throws TransactionException { try { conn.rollback(); } catch (SQLException e) { throw new TransactionException( "An error occurred when rolling back the connection", e); } }
@Override public void commit() throws TransactionException { try { conn.commit(); } catch (SQLException e) { throw new TransactionException( "An error occurred when committing the connection", e); } }
public TxConnectionWrapper(Connection delegate) { this.delegate = delegate; try { delegate.setAutoCommit(false); } catch (SQLException e) { throw new TransactionException("Unable to disable autocommit", e); } }
@Override public void commit() throws TransactionException { try { conn.commit(); } catch (SQLException e) { throw new TransactionException( "An error occurred when committing the connection", e); } }
@Override public void rollback() throws TransactionException { try { conn.rollback(); } catch (SQLException e) { throw new TransactionException( "An error occurred when rolling back the connection", e); } }
@Override public void commit() throws TransactionException { try { em.getTransaction().commit(); } catch (PersistenceException e) { throw new TransactionException( "An error occurred when committing the connection", e); } }
@Override public void rollback() throws TransactionException { try { em.getTransaction().rollback(); } catch (PersistenceException e) { throw new TransactionException( "An error occurred when rolling back the connection", e); } }
private void checkEnlistment(Map<String, Object> resourceProviderProperties) { if (toBoolean(resourceProviderProperties, XA_ENLISTMENT_ENABLED, false)) { throw new TransactionException("This Resource Provider does not support XA transactions"); } else if (!toBoolean(resourceProviderProperties, LOCAL_ENLISTMENT_ENABLED, true)) { throw new TransactionException( "This Resource Provider always enlists in local transactions as it does not support XA"); } }
private void checkEnlistment(Map<String, Object> resourceProviderProperties) { if (toBoolean(resourceProviderProperties, XA_ENLISTMENT_ENABLED, false)) { throw new TransactionException("This Resource Provider does not support XA transactions"); } else if (!toBoolean(resourceProviderProperties, LOCAL_ENLISTMENT_ENABLED, true)) { throw new TransactionException( "This Resource Provider always enlists in local transactions as it does not support XA"); } } }
@Override public AbstractJDBCConnectionProvider getProviderFor(XADataSource ds, Map<String, Object> resourceProviderProperties) { checkEnlistment(resourceProviderProperties); DataSource unpooled; if(ds instanceof DataSource) { unpooled = (DataSource) ds; } else { throw new TransactionException("This resource Provider does not support XA transactions, and the supplied XADataSource is not a DataSource"); } return new JDBCConnectionProviderImpl(poolIfNecessary(resourceProviderProperties, unpooled)); }