Package org.springframework.transaction

Examples of org.springframework.transaction.TransactionSystemException


      try {
        transactionManagerClass = getClass().getClassLoader().loadClass(FALLBACK_TRANSACTION_MANAGER_CLASS_NAME);
        transactionClass = getClass().getClassLoader().loadClass(FALLBACK_TRANSACTION_CLASS_NAME);
      }
      catch (ClassNotFoundException ex2) {
        throw new TransactionSystemException(
            "Could not initialize OC4JJtaTransactionManager because OC4J API classes are not available", ex);
      }
    }

    // Cache reflective Method references for later use.
View Full Code Here


      */
      try {
        this.beginWithNameMethod.invoke(txObject.getUserTransaction(), new Object[] {definition.getName()});
      }
      catch (InvocationTargetException ex) {
        throw new TransactionSystemException(
            "OC4J's UserTransaction.begin(String) method failed", ex.getTargetException());
      }
      catch (Exception ex) {
        throw new TransactionSystemException(
            "Could not invoke OC4J's UserTransaction.begin(String) method", ex);
      }
    }
    else {
      // No OC4J UserTransaction available or no transaction name specified
      // -> standard JTA begin call.
      txObject.getUserTransaction().begin();
    }

    // Specify isolation level, if any, through the corresponding OC4J transaction method.
    if (this.setTransactionIsolationMethod != null) {
      if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
        try {
          Transaction tx = getTransactionManager().getTransaction();
          /*
          oracle.j2ee.transaction.OC4JTransaction otx = (oracle.j2ee.transaction.OC4JTransaction) tx;
          otx.setTransactionIsolation(definition.getIsolationLevel());
          */
          Integer isolationLevel = new Integer(definition.getIsolationLevel());
          this.setTransactionIsolationMethod.invoke(tx, new Object[] {isolationLevel});
        }
        catch (InvocationTargetException ex) {
          throw new TransactionSystemException(
              "OC4J's Transaction.setTransactionIsolation(int) method failed", ex.getTargetException());
        }
        catch (Exception ex) {
          throw new TransactionSystemException(
              "Could not invoke OC4J's Transaction.setTransactionIsolation(int) method", ex);
        }
      }
    }
    else {
View Full Code Here

      Class clazz = Thread.currentThread().getContextClassLoader().loadClass(FACTORY_CLASS_5_1);
      Method method = clazz.getMethod("getTransactionManager", (Class[]) null);
      this.transactionManager = (TransactionManager) method.invoke(null, (Object[]) null);
    }
    catch (ClassNotFoundException ex) {
      throw new TransactionSystemException(
          "Could not find WebSphere 5.1/6.0/6.1 TransactionManager factory class", ex);
    }
    catch (InvocationTargetException ex) {
      throw new TransactionSystemException(
          "WebSphere's TransactionManagerFactory.getTransactionManager method failed", ex.getTargetException());
    }
    catch (Exception ex) {
      throw new TransactionSystemException(
          "Could not access WebSphere's TransactionManagerFactory.getTransactionManager method", ex);
    }
  }
View Full Code Here

    }
    try {
      con.commit();
    }
    catch (SQLException ex) {
      throw new TransactionSystemException("Could not commit JDBC transaction", ex);
    }
  }
View Full Code Here

    }
    try {
      con.rollback();
    }
    catch (SQLException ex) {
      throw new TransactionSystemException("Could not roll back JDBC transaction", ex);
    }
  }
View Full Code Here

                new JtaLobCreatorSynchronization(lobCreator));
            return;
          }
        }
        catch (Throwable ex) {
          throw new TransactionSystemException(
              "Could not register synchronization with JTA TransactionManager", ex);
        }
      }
      throw new IllegalStateException("Active Spring transaction synchronization or active " +
          "JTA transaction with specified [javax.transaction.TransactionManager] required");
View Full Code Here

        DataAccessException dex = getJpaDialect().translateExceptionIfPossible((RuntimeException) ex.getCause());
        if (dex != null) {
          throw dex;
        }
      }
      throw new TransactionSystemException("Could not commit JPA transaction", ex);
    }
    catch (RuntimeException ex) {
      // Assumably failed to flush changes to database.
      throw DataAccessUtils.translateIfNecessary(ex, getJpaDialect());
    }
View Full Code Here

      if (tx.isActive()) {
        tx.rollback();
      }
    }
    catch (PersistenceException ex) {
      throw new TransactionSystemException("Could not roll back JPA transaction", ex);
    }
    finally {
      if (!txObject.isNewEntityManagerHolder()) {
        // Clear all pending inserts/updates/deletes in the EntityManager.
        // Necessary for pre-bound EntityManagers, to avoid inconsistent state.
View Full Code Here

  public void rollbackToSavepoint(Object savepoint) throws TransactionException {
    try {
      getConnectionHolderForSavepoint().getConnection().rollback((Savepoint) savepoint);
    }
    catch (Throwable ex) {
      throw new TransactionSystemException("Could not roll back to JDBC savepoint", ex);
    }
  }
View Full Code Here

    }
    try {
      con.commit();
    }
    catch (SQLException ex) {
      throw new TransactionSystemException("Could not commit JDBC transaction", ex);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.transaction.TransactionSystemException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.