Package org.hibernate

Examples of org.hibernate.Transaction.rollback()


        }
      }
      transaction.commit();
    } catch(HibernateException he) {
      if(transaction!=null) {
        transaction.rollback();
      }
      throw new ExporterException("Error occured while trying to execute query", he);
    } finally {     
      if(session!=null) {
        session.close();       
View Full Code Here


      fail( "Cannot persist() twice the same entity" );
    }
    catch (ConstraintViolationException cve) {
      //verify that an exception is thrown!
    }
    tx.rollback();
    s.close();

    Node nondupe = new Node( "nondupe" );
    nondupe.addChild( dupe );
View Full Code Here

      assertFalse( true );
    }
    catch (ConstraintViolationException cve) {
      //verify that an exception is thrown!
    }
    tx.rollback();
    s.close();
  }

  public void testCreateExceptionWithGeneratedId() {
    Session s = openSession();
View Full Code Here

      assertFalse( true );
    }
    catch (PersistentObjectException poe) {
      //verify that an exception is thrown!
    }
    tx.rollback();
    s.close();

    NumberedNode nondupe = new NumberedNode( "nondupe" );
    nondupe.addChild( dupe );
View Full Code Here

      assertFalse( true );
    }
    catch (PersistentObjectException poe) {
      //verify that an exception is thrown!
    }
    tx.rollback();
    s.close();
  }

  public void testBasic() throws Exception {
    Session s;
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();
    a.setCountry( "Country" );
View Full Code Here

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

  public void testComponents() throws Exception {
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.