Package org.hibernate

Examples of org.hibernate.Session.merge()


    addMembership( user, group, membership );
    membership.setName( "membership1" );

    Session s = openSession();
    s.beginTransaction();
    s.merge( user );
    s.getTransaction().commit();
    s.close();

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


    addMembership( user, group, membership );
    membership.setName( "membership1" );

    Session s = openSession();
    s.beginTransaction();
    s.merge( user );
    s.getTransaction().commit();
    s.close();

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

    // change detached thing name to a new non-null name and save it
    thing.setName("one_changed");

    s = openSession();
    t = s.beginTransaction();
    s.merge(thing);
    t.commit();
    s.close();

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

    // give detached thing a null name and save it
    thing.setName(null);

    s = openSession();
    t = s.beginTransaction();
    s.merge(thing);
    t.commit();
    s.close();

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

    p.addContract( c );

    s = openSession();
    t = s.beginTransaction();
    p = ( Plan ) s.merge( p );
    t.commit();
    s.close();

    assertInsertCount( 0 );
    assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0 );
View Full Code Here

    Contract newC = new Contract( null, "yogi", "mail" );
    p.addContract( newC );

    s = openSession();
    t = s.beginTransaction();
    p = ( Plan ) s.merge( p );
    t.commit();
    s.close();

    assertInsertCount( 1 );
    assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0 );
View Full Code Here

    // change detached thing name to a non-null value
    thing.setName("two");

    s = openSession();
    t = s.beginTransaction();
    s.merge(thing);
    t.commit();
    s.close();

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

   
    prod.getParts().remove(part);
   
    session = openSession();
    t = session.beginTransaction();
    session.merge(prod);
    t.commit();
    session.close();
   
    session = openSession();
    t = session.beginTransaction();
View Full Code Here

    if ( isPlanContractsBidirectional ) {
      assertEquals( 0, c.getPlans().size() );
    }
    s = openSession();
    t = s.beginTransaction();
    p = ( Plan ) s.merge( p );
    t.commit();
    s.close();

    assertUpdateCount( isContractVersioned ? 1 : 0 );
    assertDeleteCount( 0 );
View Full Code Here

      assertEquals( 0, c.getPlans().size() );
    }

    s = openSession();
    t = s.beginTransaction();
    p = ( Plan ) s.merge( p );
    c = ( Contract ) s.merge( c );
    t.commit();
    s.close();

    assertUpdateCount( isContractVersioned  && isPlanVersioned ? 2 : 0 );
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.