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


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

  @Override
  @SuppressWarnings({ "unchecked" })
  public TypedQuery<X> setLockMode(javax.persistence.LockModeType lockModeType) {
    checkOpen( true );
    if (! getEntityManager().isTransactionInProgress()) {
      throw new TransactionRequiredException( "no transaction is in progress" );
    }
    if ( ! canApplyAliasSpecificLockModeHints() ) {
      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" );
      }
      getSession().flush();
    }
    catch ( RuntimeException e ) {
      throw convert( e );
View Full Code Here

  public void lock(Object entity, LockModeType lockModeType, Map<String, Object> properties) {
    LockOptions lockOptions = null;
    try {
      if ( !isTransactionInProgress() ) {
        throw new TransactionRequiredException( "no transaction is in progress" );
      }
      if ( !contains( entity ) ) {
        throw new IllegalArgumentException( "entity not in the persistence context" );
      }
      getSession().buildLockRequest( ( lockOptions = getLockRequest( lockModeType, properties ) ) )
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 if ( transaction.getJoinStatus() == JoinStatus.MARKED_FOR_JOINED ) {
        throw new AssertionFailure( "Transaction MARKED_FOR_JOINED after isOpen() call" );
      }
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

    return Collections.unmodifiableMap( properties );
  }

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

  }

  public void lock(Object entity, LockModeType lockModeType, Map<String, Object> properties) {
    LockOptions lockOptions = null;
    if ( !isTransactionInProgress() ) {
      throw new TransactionRequiredException( "no transaction is in progress" );
    }

    try {
      if ( !contains( entity ) ) {
        throw new IllegalArgumentException( "entity not in the persistence context" );
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.