Package org.hibernate

Examples of org.hibernate.Transaction.rollback()


      s.merge(user);

      tx.commit();
    }
    catch (Exception e) {
      if (tx!=null) tx.rollback();
      throw e;
    }
    finally {
      s.close();
    }
View Full Code Here


      item.setDescription(description);

      tx.commit();
    }
    catch (Exception e) {
      if (tx!=null) tx.rollback();
      throw e;
    }
    finally {
      s.close();
    }
View Full Code Here

      );

      tx.commit();
    }
    catch (Exception e) {
      if (tx!=null) tx.rollback();
      throw e;
    }
    finally {
      s.close();
    }
View Full Code Here

      System.out.println();

      tx.commit();
    }
    catch (Exception e) {
      if (tx!=null) tx.rollback();
      throw e;
    }
    finally {
      s.close();
    }
View Full Code Here

            fail("expected stale write to fail");
        } catch (Throwable expected) {
            // expected behavior here
            if (txn != null) {
                try {
                    txn.rollback();
                } catch (Throwable ignore) {
                }
            }
        } finally {
            if (s != null && s.isOpen()) {
View Full Code Here

      assertTrue( "Environment.MESSAGE_INTERPOLATOR_CLASS does not work",
          e.getInvalidValues()[0].getMessage().startsWith( "prefix_")
      );
    }
    finally {
      if ( tx != null ) tx.rollback();
      s.close();
    }

    a = new Address();
    Address.blacklistedZipCode = "3232";
View Full Code Here

      assertTrue( "Environment.MESSAGE_INTERPOLATOR_CLASS does not work",
          e.getInvalidValues()[0].getMessage().startsWith( "prefix_")
      );
    }
    finally {
      if ( tx != null ) tx.rollback();
      s.close();
    }

    s = openSession();
    tx = s.beginTransaction();
View Full Code Here

    }
    catch (InvalidStateException e) {
      assertEquals( 2, e.getInvalidValues().length );
    }
    finally {
      tx.rollback();
      s.close();
    }
  }

  public void testIdClass() throws Exception {
View Full Code Here

    }
    catch (InvalidStateException e) {
      assertEquals( 1, e.getInvalidValues().length );
    }
    finally {
      tx.rollback();
      s.close();
    }
  }

  protected void configure(Configuration cfg) {
View Full Code Here

    assertEquals( 0, ccValid.getInvalidValues( cc ).length );
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    s.persist( cc );
    s.flush();
    tx.rollback();
    s.close();
  }

  protected Class[] getMappings() {
    return new Class[]{
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.