Package javax.persistence

Examples of javax.persistence.EntityTransaction.rollback()


    PersistenceSessionUtil.closeSession(idf);
   
    return listAppoints;
    }catch(Exception e){
      log.error("Error in getTodaysAppoitmentsbyRangeAndMember : " + e.getMessage());
      tx.rollback();
      return null;
    }
  }
 
 
View Full Code Here


    Users u = null;
    try {
      u = (Users) q.getSingleResult();
      tx.commit();
    } catch (NoResultException e) {
      tx.rollback();
      // u=null}
    } catch (NonUniqueResultException ex) {
      tx.rollback();
    }
View Full Code Here

      tx.commit();
    } catch (NoResultException e) {
      tx.rollback();
      // u=null}
    } catch (NonUniqueResultException ex) {
      tx.rollback();
    }

    PersistenceSessionUtil.closeSession(idf);

    return u;
View Full Code Here

      }
      finally {
        EntityTransaction transaction = em.getTransaction();
        if ( transaction != null && transaction.isActive() ) {
          transaction.rollback();
        }
        em.close();
      }
    }
    finally {
View Full Code Here

        EntityTransaction t = em.getTransaction();
        assertNotNull(t);
        t.begin();
        t.setRollbackOnly();
        t.rollback();

        // openjpa-facade test
        assertTrue(em instanceof OpenJPAEntityManager);
        OpenJPAEntityManager ojem = (OpenJPAEntityManager) em;
        ojem.getFetchPlan().setMaxFetchDepth(-1);
View Full Code Here

        EntityTransaction t = em.getTransaction();
        assertNotNull(t);
        t.begin();
        t.setRollbackOnly();
        t.rollback();

        // openjpa-facade test
        assertTrue(em instanceof OpenJPAEntityManager);
        OpenJPAEntityManager ojem = (OpenJPAEntityManager) em;
        ojem.getFetchPlan().setMaxFetchDepth(1);
View Full Code Here

    protected boolean rollback() {
        EntityTransaction tx = em.getTransaction();
        if (!tx.isActive())
            return false;

        tx.rollback();
        return true;
    }

    /**
     * Closes the current EntityManager if it is open.
View Full Code Here

      tx.begin();
      em.persist(usr);
      em.getTransaction().commit();
    } catch (Exception e) {
      logger.warning("Rolling Back: " + e.toString());
      tx.rollback();
    } finally {
      em.close();
    }
    logger.info("Exiting createContact");
View Full Code Here

            Object answer = callback.doInJpa(em);
            transaction.commit();
            return answer;
        } catch (RuntimeException e) {
            if (transaction != null) {
                transaction.rollback();
            }
            throw e;
        }
    }
View Full Code Here

                        if (transaction != null && transaction.isActive())
                        {
                            try
                            {
                                transaction.rollback();
                            }
                            catch (Exception eRollback)
                            {
                                if(LOGGER.isLoggable(Level.SEVERE))
                                {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.