Package org.hibernate

Examples of org.hibernate.Session.merge()


    dpProxy = ( DataPoint ) s.merge( dpProxy );
    assertTrue( s.isReadOnly( dpProxy ) );
    assertTrue( Hibernate.isInitialized( dpProxy ) );
    assertEquals( "description", dpProxy.getDescription() );
    dpProxy.setDescription( null );
    dpProxy = ( DataPoint ) s.merge( dp );
    assertTrue( s.isReadOnly( dpProxy ) );
    assertTrue( Hibernate.isInitialized( dpProxy ) );
    assertEquals( "description", dpProxy.getDescription() );   
    t.commit();
    s.close();
View Full Code Here


    prod.getParts().remove( mapKey );

    session = openSession();
    t = session.beginTransaction();
    session.merge(prod);
    t.commit();
    session.close();

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

    // now try to reattch it
    s = openSession();
    s.beginTransaction();
    try {
      s.merge( entity );
      s.getTransaction().commit();
      fail( "was expecting staleness error" );
    }
    catch ( StaleObjectStateException expected ) {
      // expected outcome...
View Full Code Here

    emp.getOptionalComponent().setValue1( "emp-value1" );
    emp.getOptionalComponent().setValue2( "emp-value2" );

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

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

    emp.getOptionalComponent().setValue1( null );
    emp.getOptionalComponent().setValue2( null );

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

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

    clearCounts();

    p.getDetails().setSomePersonalDetail( p.getDetails().getSomePersonalDetail() + " and big hands too" );
    s = openSession();
        s.beginTransaction();
    p = ( Person ) s.merge( p );
    s.getTransaction().commit();
    s.close();

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

    emp1.getPerson().setDob( new Date() );
    emp.getDirectReports().add( emp1 );

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

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

    emp1.getOptionalComponent().setValue1( "emp1-value1" );
    emp1.getOptionalComponent().setValue2( "emp1-value2" );

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

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

    clearCounts();

    p.getAddress().setStreetAddress( "321 Main" );
    s = openSession();
        s.beginTransaction();
    p = ( Person ) s.merge( p );
    s.getTransaction().commit();
    s.close();

    assertInsertCount( 0 );
    assertUpdateCount( 0 ); // no cascade
View Full Code Here

    emp1.getOptionalComponent().setValue1( null );
    emp1.getOptionalComponent().setValue2( null );

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

    s = openSession();
    t = s.beginTransaction();
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.