Package javax.persistence

Examples of javax.persistence.TransactionRequiredException


   */
  @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


  @SuppressWarnings({ "unchecked" })
  public TypedQuery<X> setLockMode(javax.persistence.LockModeType lockModeType) {

    if (! getEntityManager().isTransactionInProgress()) {
      throw new TransactionRequiredException( "no transaction is in progress" );
    }

    this.jpaLockMode = lockModeType;
    query.setLockOptions(getEntityManager().getLockRequest(lockModeType, null));
    return this;
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 ( RuntimeException 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" );
      }
      //adjustFlushMode();
      if ( !contains( entity ) ) {
        throw new IllegalArgumentException( "entity not in the persistence context" );
      }
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 ( joinableCMTTransaction.getStatus() == JoinableCMTTransaction.JoinStatus.MARKED_FOR_JOINED ) {
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

      // 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

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.