Package javax.persistence

Examples of javax.persistence.TransactionRequiredException


      // join the transaction and then recheck the status
      transaction.join();
      if ( transaction.getJoinStatus() == JoinStatus.NOT_JOINED ) {
        if ( explicitRequest ) {
          throw new TransactionRequiredException( "No active JTA transaction on joinTransaction call" );
        }
        else {
          LOG.debug( "Unable to join JTA transaction" );
          return;
        }
View Full Code Here


  @Override
  @SuppressWarnings({ "ThrowableInstanceNeverThrown" })
  public int executeUpdate() {
    try {
      if ( ! entityManager.isTransactionInProgress() ) {
        entityManager.throwPersistenceException( new TransactionRequiredException( "Executing an update/delete query" ) );
        return 0;
      }
      return internalExecuteUpdate();
    }
    catch ( QueryExecutionRequestException he) {
View Full Code Here

  @Override
    @SuppressWarnings({ "unchecked" })
  public TypedQuery<X> setLockMode(javax.persistence.LockModeType lockModeType) {
    if (! getEntityManager().isTransactionInProgress()) {
      throw new TransactionRequiredException( "no transaction is in progress" );
    }
    if ( ! canApplyLockModes() ) {
      throw new IllegalStateException( "Not a JPAQL/Criteria query" );
    }
    this.jpaLockMode = lockModeType;
View Full Code Here

   */
  @SuppressWarnings({ "ThrowableInstanceNeverThrown" })
  public int executeUpdate() {
    try {
      if ( ! entityManager.isTransactionInProgress() ) {
        entityManager.throwPersistenceException( new TransactionRequiredException( "Executing an update/delete query" ) );
        return 0;
      }
      return internalExecuteUpdate();
    }
    catch ( QueryExecutionRequestException he) {
View Full Code Here

  @Override
    @SuppressWarnings({ "unchecked" })
  public TypedQuery<X> setLockMode(javax.persistence.LockModeType lockModeType) {
    if (! getEntityManager().isTransactionInProgress()) {
      throw new TransactionRequiredException( "no transaction is in progress" );
    }
    if ( ! canApplyLockModes() ) {
      throw new IllegalStateException( "Not a JPAQL/Criteria query" );
    }
    this.jpaLockMode = lockModeType;
View Full Code Here

  }

  private void checkTransactionNeeded() {
    if ( persistenceContextType == PersistenceContextType.TRANSACTION && ! isTransactionInProgress() ) {
      //no need to mark as rollback, no tx in progress
      throw new TransactionRequiredException(
          "no transaction is in progress for a TRANSACTION type persistence context"
      );
    }
  }
View Full Code Here

  }

  public void flush() {
    try {
      if ( ! isTransactionInProgress() ) {
        throw new TransactionRequiredException( "no transaction is in progress" );
      }
      //adjustFlushMode();
      getSession().flush();
    }
    catch (HibernateException he) {
View Full Code Here

  }

  public void lock(Object entity, LockModeType lockMode) {
    try {
      if ( ! isTransactionInProgress() ) {
        throw new TransactionRequiredException( "no transaction is in progress" );
      }
      //adjustFlushMode();
      if ( !contains( entity ) ) throw new IllegalArgumentException( "entity not in the persistence context" );
      getSession().lock( entity, getLockMode( lockMode ) );
    }
View Full Code Here

            if ( ignoreNotJoining ) {
              log.debug( "No JTA transaction found" );
              return;
            }
            else {
              throw new TransactionRequiredException(
                  "No active JTA transaction on joinTransaction call"
              );
            }
          }
          else
View Full Code Here

  }

  public int executeUpdate() {
    try {
      if ( ! em.isTransactionInProgress() ) {
        em.throwPersistenceException( new TransactionRequiredException( "Executing an update/delete query" ) );
        return 0;
      }
      return query.executeUpdate();
    }
    catch (QueryExecutionRequestException he) {
View Full Code Here

TOP

Related Classes of javax.persistence.TransactionRequiredException

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.