Package javax.persistence

Examples of javax.persistence.EntityTransaction.commit()


    else {
      EntityTransaction tx = entityManager.getTransaction();
      try {
        tx.begin();
        Object result = action.execute(method, parameters);
        tx.commit();
        return result;
      } catch (Exception e) {
        tx.rollback();
        throw e.getCause();
      }
View Full Code Here


    try {
      //执行被拦截的业务方法
      result = methodInvocation.proceed();
      //提交事务
      if(type != TransactionalType.READOLNY){
        transaction.commit();
      }
    } catch (Exception e) {
      //回滚当前事务
      if(type != TransactionalType.READOLNY && transaction.isActive()){
        transaction.rollback();
View Full Code Here

      if(need2ProcessTransaction){
        if(hbTS != null)
          hbTS.commit();
        if(jpaTS != null)
          jpaTS.commit();
      }
    } catch (Exception e) {
      if(hbTS != null)
        hbTS.rollback();
      if(jpaTS != null)
View Full Code Here

    flv.setValue("test");
    flv.setLanguage_id(33L);
    flv.setDeleted("false");
    try {
      flv = getEntityManager().merge(flv);
      tx.commit();
    } catch (Exception e) {
      tx.rollback();
      throw new Exception(e.getMessage());
    }
View Full Code Here

    fl.setName("test value");
    fl.setFieldlanguagesvalue(flv);
    fl.setDeleted("false");
    try {
      getEntityManager().merge(fl);
      tx.commit();
    } catch (Exception e) {
      tx.rollback();
      throw new Exception(e.getMessage());
    }
View Full Code Here

    conf.setDeleted("false");
    conf.setConf_key("key1");
    conf.setConf_value("value1");
    try {
      conf = getEntityManager().merge(conf);
      tx.commit();
    } catch (Exception e) {
      tx.rollback();
      throw new Exception(e.getMessage());
    }
   
View Full Code Here

    Long id = conf.getConfiguration_id();
    tx.begin();
    try {
      conf = getEntityManager().find(Configuration.class, id);
      getEntityManager().remove(conf);
      tx.commit();
    } catch (Exception e) {
      tx.rollback();
      throw new Exception(e.getMessage());
    }
    result = q.getResultList();
View Full Code Here

    eValue.setStarttime(new Date());
    eValue.setFieldvalues_id(new Long(322));
    tx.begin();
    try {
      getEntityManager().merge(eValue);
      tx.commit();
    } catch (Exception e) {
      tx.rollback();
      throw new Exception(e.getMessage());
    }
  }
View Full Code Here

    sl.setFieldvalues_id(1000L);
    sl.setStarttime(new Date());
    tx.begin();
    try {
      getEntityManager().merge(sl);
      tx.commit();
    } catch (Exception e) {
      tx.rollback();
      throw new Exception(e.getMessage());
    }
   
View Full Code Here

    fl.setStarttime(new Date());
    fl.setName("test value");
    fl.setDeleted("false");
    try {
      getEntityManager().merge(fl);
      tx.commit();
    } catch (Exception e) {
      tx.rollback();
      throw new Exception(e.getMessage());
    }
  }
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.