Package org.hibernate

Examples of org.hibernate.Transaction.rollback()


    if(transactions == null)
      return;
    Transaction tx = (Transaction)transactions.get();
    transactions.set(null);
    if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
      tx.rollback();
    }
    else{
      if(tx!=null && log.isWarnEnabled())
        log.warn("Trying to rollback the unrollbackable transaction, nothing to do.");
    }
View Full Code Here


     
      tx.commit();
      System.out.println("============== DLOG4J upgraded.=================");
    }catch(Exception e){
      e.printStackTrace();
      tx.rollback();
    }finally{
      old_hb.destroy();
      new_hb.destroy();
    }
       
View Full Code Here

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

        transaction.commit();
      }
    } catch (Exception e) {
      //回滚当前事务
      if(type != TransactionalType.READOLNY && transaction.isActive()){
        transaction.rollback();
      }
      throw e;
    }
   
    log.debug("[HibernateLocalTransactionInterceptor]离开=》"+methodInvocation.getMethod().getName());
View Full Code Here

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

      chId = (int) channel.getId();
      tx.commit();
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
      if (tx != null) tx.rollback();
      throw he;
    }
    assertTrue("No valid channel created.", chId >= 0);

    // -- try to retrieve channel and check the unread statuses
View Full Code Here

      tx.commit();
      catId = new Long(catA.getId());
      System.out.println("Saved category with id " + catId + " persistently");
    }
    catch (HibernateException he) {
      if (tx != null) tx.rollback();
      throw he;
    }
    finally {
      session.close();
    }
View Full Code Here

      Category theCat = (Category) session.load(Category.class, catId);
      theCat.setTitle("Another category title");
      tx.commit();
      System.out.println("Updated category title for id: " + catId);
    } catch (HibernateException he) {
      if (tx != null) tx.rollback();
      throw he;
    }
    finally {
      session.close()
    }
View Full Code Here

      while (it.hasNext()) {
        Category c = (Category) it.next();
        System.out.println("--> " + c.getId());
      }
    } catch (HibernateException he2) {
      if (tx != null) tx.rollback();
      throw he2;
    }
    finally {
      session.close()
    }
View Full Code Here

      chId = (int) channel.getId();
      chGrpId = (int) grp1.getId();
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
      if (tx != null) tx.rollback();
      throw he;
    }
    assertTrue("No valid channel created.", chId >= 0);
    assertTrue("No valid channel group created.", chGrpId >= 0);
    // -- try to retrieve channel and the assigned category
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.