Package org.hibernate

Examples of org.hibernate.TransactionException


    log.debug("begin");
   
    boolean synchronization = jdbcContext.registerSynchronizationIfPossible();

    if ( !synchronization ) {
      throw new TransactionException("Could not register synchronization for container transaction");
    }

    begun = true;
   
    jdbcContext.afterTransactionBegin(this);
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public void commit() throws HibernateException {
    if (!begun) {
      throw new TransactionException("Transaction not successfully started");
    }

    log.debug("commit");

    boolean flush = !transactionContext.isFlushModeNever() &&
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void rollback() throws HibernateException {
    if (!begun) {
      throw new TransactionException("Transaction not successfully started");
    }

    log.debug("rollback");

    try {
      getTransaction().setRollbackOnly();
    }
    catch (SystemException se) {
      log.error("Could not set transaction to rollback only", se);
      throw new TransactionException("Could not set transaction to rollback only", se);
    }

    begun = false;

  }
View Full Code Here

    try {
      status = getTransaction().getStatus();
    }
    catch (SystemException se) {
      log.error("Could not determine transaction status", se);
      throw new TransactionException("Could not determine transaction status: ", se);
    }
    if (status==Status.STATUS_UNKNOWN) {
      throw new TransactionException("Could not determine transaction status");
    }
    else {
      return status==Status.STATUS_ACTIVE;
    }
  }
View Full Code Here

    try {
      status = getTransaction().getStatus();
    }
    catch (SystemException se) {
      log.error("Could not determine transaction status", se);
      throw new TransactionException("Could not determine transaction status", se);
    }
    if (status==Status.STATUS_UNKNOWN) {
      throw new TransactionException("Could not determine transaction status");
    }
    else {
      return JTAHelper.isRollback(status);
    }
  }
View Full Code Here

    try {
      status = getTransaction().getStatus();
    }
    catch (SystemException se) {
      log.error("Could not determine transaction status", se);
      throw new TransactionException("Could not determine transaction status: ", se);
    }
    if (status==Status.STATUS_UNKNOWN) {
      throw new TransactionException("Could not determine transaction status");
    }
    else {
      return status==Status.STATUS_COMMITTED;
    }
  }
View Full Code Here

  public void registerSynchronization(Synchronization sync) throws HibernateException {
    try {
      getTransaction().registerSynchronization(sync);
    }
    catch (Exception e) {
      throw new TransactionException("Could not register synchronization", e);
    }
  }
View Full Code Here

  private void setTimeout(PreparedStatement result) throws SQLException {
    if ( isTransactionTimeoutSet ) {
      int timeout = (int) ( transactionTimeout - ( System.currentTimeMillis() / 1000 ) );
      if (timeout<=0) {
        throw new TransactionException("transaction timeout expired");
      }
      else {
        result.setQueryTimeout(timeout);
      }
    }
View Full Code Here

      }
      catch( HibernateException e ) {
        throw e;
      }
      catch (Exception e) {
        throw new TransactionException( "could not register synchronization with JTA TransactionManager", e );
      }
    }
  }
View Full Code Here

    TransactionManager tm = factory.getTransactionManager();
    try {
      return tm != null && isTransactionInProgress( tm.getTransaction() );
    }
    catch (SystemException se) {
      throw new TransactionException( "could not obtain JTA Transaction", se );
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.TransactionException

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.