Package javax.persistence

Examples of javax.persistence.TransactionRequiredException


    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

        private void transactionStarted(InstanceId instanceId) {
            if (instanceId == null) {
                throw new NullPointerException("instanceId is null");
            }
            if (!isTransactionActive()) {
                throw new TransactionRequiredException();
            }

            Map<EntityManagerFactory, EntityManagerTracker> entityManagers = entityManagersByDeploymentId.get(instanceId);
            if (entityManagers == null) {
                return;
View Full Code Here

     * required for some operations on the entity manager.
     * @throws TransactionRequiredException if non-extended and a transaction is not active
     */
    private void assertTransactionActive() throws TransactionRequiredException {
        if (!extended && !isTransactionActive()) {
            throw new TransactionRequiredException();
        }
    }
View Full Code Here

        else {
          if (!enforce) {
            logger.debug("No local transaction to join");
          }
          else {
            throw new TransactionRequiredException("No local transaction to join");
          }
        }
      }
    }
View Full Code Here

    EntityExistsException entityExists = new EntityExistsException("foo");
    assertSame(DataIntegrityViolationException.class,
        EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(entityExists).getClass());

    TransactionRequiredException transactionRequired = new TransactionRequiredException("foo");
    assertSame(InvalidDataAccessApiUsageException.class,
        EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(transactionRequired).getClass());

    PersistenceException unknown = new PersistenceException() {
    };
View Full Code Here

    /**
     * @throws TransactionRequiredException if there is no transaction in progress.
     */
    protected void checkTransaction() throws TransactionRequiredException {
        if (!getJtaFactory().isActiveTransaction()) {
            throw new TransactionRequiredException();
        }
    }
View Full Code Here

     */
    private void assertIsActive()
    {
        if (!isTransactionActive())
        {
            throw new TransactionRequiredException(LOCALISER.msg("EM.TransactionRequired"));
        }
    }
View Full Code Here

     */
    private void assertLockModeValid(LockModeType lock)
    {
        if (lock != null && lock != LockModeType.NONE && !isTransactionActive())
        {
            throw new TransactionRequiredException(LOCALISER.msg("EM.TransactionRequired"));
        }
    }
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.