Package javax.persistence

Examples of javax.persistence.RollbackException


    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

    /*
     * Ensure that parameter values are not included in exception text by default.
     */
    public void testNoParamsByDefault() {
        RollbackException e = getRollbackException(PObject.class, CLEAR_TABLES);

        assertFalse(Pattern.matches(_regex, e.toString()));
        Throwable nested = e.getCause();
        while (nested != null) {
            if (Pattern.matches(".*INSERT.*", nested.toString())) {
                // only check if the message contains the insert statement.
                assertFalse(Pattern.matches(_regex, nested.toString()));
            }
View Full Code Here

    /*
     * If the EMF is created with PrintParameters=true the parameter values will be logged in exception text.
     */
    public void testParamsEnabledByConfig() {
        RollbackException e =
            getRollbackException(PObject.class, CLEAR_TABLES, "openjpa.ConnectionFactoryProperties",
                "PrintParameters=true");
        assertFalse(Pattern.matches(_regex, e.toString()));
        Throwable nested = e.getCause();
        assertNotNull(nested); // expecting at least one nested exception.
        while (nested != null) {
            if (Pattern.matches(".*INSERT.*", nested.toString())) {
                // only check if the message contains the insert statement.
                assertTrue(Pattern.matches(_regex, nested.toString()));
View Full Code Here

                  this.wrapper.localUOW.commit();
                  // all change sets and are cleared, but the cache is kept
                  this.wrapper.localUOW.clearForClose(false);
                }
            } else {
                throw new RollbackException(ExceptionLocalization.buildMessage("rollback_because_of_rollback_only"));
            }
        }
    }catch (RuntimeException ex){
        if (this.wrapper.localUOW != null){
            wrapper.getEntityManager().removeExtendedPersistenceContext();
            this.wrapper.localUOW.release();
            this.wrapper.localUOW.getParent().release();
        }
        if(! this.rollbackOnly) {
            throw new RollbackException(ex);
        } else {
            // it's a RollbackException
            throw ex;
        }
    } finally {
View Full Code Here

                  this.wrapper.localUOW.commit();
                  // all change sets and are cleared, but the cache is kept
                  this.wrapper.localUOW.clearForClose(false);
                }
            } else {
                throw new RollbackException(ExceptionLocalization.buildMessage("rollback_because_of_rollback_only"));
            }
        }
    }catch (RuntimeException ex){
        if (this.wrapper.localUOW != null){
            wrapper.getEntityManager().removeExtendedPersistenceContext();
            this.wrapper.localUOW.release();
            this.wrapper.localUOW.getParent().release();
        }
        if(! this.rollbackOnly) {
            throw new RollbackException(ex);
        } else {
            // it's a RollbackException
            throw ex;
        }
    } finally {
View Full Code Here

                  this.wrapper.localUOW.commit();
                  // all change sets and are cleared, but the cache is kept
                  this.wrapper.localUOW.clearForClose(false);
                }
            } else {
                throw new RollbackException(ExceptionLocalization.buildMessage("rollback_because_of_rollback_only"));
            }
        }
    }catch (RuntimeException ex){
        if (this.wrapper.localUOW != null){
            wrapper.getEntityManager().removeExtendedPersistenceContext();
            this.wrapper.localUOW.release();
            this.wrapper.localUOW.getParent().release();
        }
        if(! this.rollbackOnly) {
            throw new RollbackException(ex);
        } else {
            // it's a RollbackException
            throw ex;
        }
    } finally {
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

        SyncopeUser user = getUserFromId(userMod.getId());
        userDataBinder.update(user, userMod);
        userDAO.save(user);

        throw new RollbackException();
    }
View Full Code Here

    public void testDelete(final Long userId) throws NotFoundException, UnauthorizedRoleException {

        SyncopeUser user = getUserFromId(userId);
        userDAO.delete(user);

        throw new RollbackException();
    }
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.