Package javax.persistence

Examples of javax.persistence.RollbackException


      if (! isActiveTransaction())
        throw new IllegalStateException("commit() cannot be called when the entity transaction is not active.");

      // jpa/1525
      if (getRollbackOnly())
        throw new RollbackException("commit() cannot be called when the entity transaction is marked for rollback only.");

      try {
        // jpa/11a7
        AmberConnection.this.beforeCommit();
View Full Code Here


    public void testCreate(final UserTO userTO) {
        SyncopeUser user = new SyncopeUser();
        userDataBinder.create(user, userTO);
        userDAO.save(user);

        throw new RollbackException();
    }
View Full Code Here

    public void testUpdate(final UserMod userMod) throws NotFoundException, UnauthorizedRoleException {
        SyncopeUser user = getUserFromId(userMod.getId());
        userDataBinder.update(user, userMod);
        userDAO.save(user);

        throw new RollbackException();
    }
View Full Code Here

    @Transactional(rollbackFor = {Throwable.class})
    public void testDelete(final Long userId) throws NotFoundException, UnauthorizedRoleException {
        SyncopeUser user = getUserFromId(userId);
        userDAO.delete(user);

        throw new RollbackException();
    }
View Full Code Here

        }
        performCommit();
      }

    } catch (Exception e) {
      throw new RollbackException(e);
     
    } finally {
      // these will not throw an exception
      deactivate();
      notifyCommit();     
View Full Code Here

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof HibernateException) {
        wrappedException = entityManager.convert( (HibernateException)e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while committing the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof StaleStateException) {
        wrappedException = entityManager.wrapStaleStateException( (StaleStateException) e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while commiting the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof StaleStateException) {
        wrappedException = entityManager.wrapStaleStateException( (StaleStateException) e );
      }
      else if (e instanceof HibernateException) {
        throw entityManager.convert( (HibernateException)e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while commiting the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof HibernateException) {
        wrappedException = entityManager.convert( (HibernateException)e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while committing the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof HibernateException) {
        wrappedException = entityManager.convert( (HibernateException)e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while committing the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

TOP

Related Classes of javax.persistence.RollbackException

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.