Examples of saveOrUpdate()


Examples of org.hibernate.Session.saveOrUpdate()

    tx.commit();

    // reattach by saveOrUpdate
    tx = s.beginTransaction();
    fb.setClub("Bimbo FC SA");
    s.saveOrUpdate(fb);
    tx.commit();

    // clean up
    s.clear();
    tx = s.beginTransaction();
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    s = openSession();
    t = s.beginTransaction();
    Suite suite = new Suite();
    address.getSuites().add( suite );
    p.getAddresses().clear();
    s.saveOrUpdate( p );
    t.commit();
    s.close();

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

Examples of org.hibernate.Session.saveOrUpdate()

    t = s.beginTransaction();
    Note note = new Note();
    note.setDescription( "a description" );
    suite.getNotes().add( note );
    address.getSuites().clear();
    s.saveOrUpdate( address );
    t.commit();
    s.close();

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

Examples of org.hibernate.Session.saveOrUpdate()

        name.set(c, "phil");

    s = openSession();
    t = s.beginTransaction();
        try {
            s.saveOrUpdate( c );
      s.flush();
            fail( "should have failed because immutable natural ID was altered");
        }
        catch (HibernateException he) {
      // expected
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    s = openSession();
    tx = s.beginTransaction();
    NumberedNode child = new NumberedNode( "child" );
    root.addChild( child );
    s.saveOrUpdate( root );
    assertTrue( s.contains( child ) );
    tx.commit();

    assertInsertCount( 1 );
    assertUpdateCount( instrumented ? 0 : 1 );
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

  public void testSaveOrUpdateGotWithMutableProp() {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Node root = new Node( "root" );
    s.saveOrUpdate( root );
    tx.commit();
    s.close();

    assertInsertCount( 1 );
    assertUpdateCount( 0 );
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    assertUpdateCount( 0 );
    clearCounts();

    s = openSession();
    tx = s.beginTransaction();
    s.saveOrUpdate( root );
    tx.commit();
    s.close();

    assertInsertCount( 0 );
    assertUpdateCount( 0 );
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    s = openSession();
    tx = s.beginTransaction();
    Node child = new Node( "child" );
    root.addChild( child );
    s.saveOrUpdate( root );
    assertTrue( s.contains( child ) );
    tx.commit();

    assertInsertCount( 1 );
    assertUpdateCount( 1 ); //note: will fail here if no second-level cache
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    Node parent = new Node( "1:parent" );
    Node child = new Node( "2:child" );
    Node grandchild = new Node( "3:grandchild" );
    parent.addChild( child );
    child.addChild( grandchild );
    s.saveOrUpdate( parent );
    s.getTransaction().commit();
    s.close();

    Session s1 = openSession();
    s1.getTransaction().begin();
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    assertTrue( s1.contains( child.getParent() ) );

    Session s2 = openSession();
    try {
      s2.getTransaction().begin();
      s2.saveOrUpdate( child );
      fail();
    }
    catch ( HibernateException ex ) {
      // expected because parent is connected to s1
    }
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.