Package org.hibernate

Examples of org.hibernate.Session.merge()


    }

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

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


    s = openSession();
    t = s.beginTransaction();
    User u2 = ( User ) s.createCriteria( User.class ).uniqueResult();
    u2.setPermissions( null ); //forces one shot delete
    s.merge( u );
    t.commit();
    s.close();

    u.getPermissions().add( new Permission( "silliness" ) );
View Full Code Here

    u.getPermissions().add( new Permission( "silliness" ) );

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

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

    s = openSession();
    t = s.beginTransaction();
    pOrig.removeContract( cOrig );
    try {
      s.merge( pOrig );
      assertFalse( isContractVersioned );
    }
    catch (StaleObjectStateException ex) {
      assertTrue( isContractVersioned);
    }
View Full Code Here

    s = openSession();
    s.setCacheMode(CacheMode.IGNORE);
    t = s.beginTransaction();
    s.setDefaultReadOnly( true );
    DataPoint dpManaged = ( DataPoint ) s.get( DataPoint.class, new Long( dp.getId() ) );
    DataPoint dpMerged = ( DataPoint ) s.merge( dp );
    assertSame( dpManaged, dpMerged );
    t.commit();
    s.close();

    s = openSession();
View Full Code Here

    deleteMembership( user, group, membership );
    addMembership( user, group, membership );

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

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

    s.close();
    s = openSession();
    t = s.beginTransaction();
    Parent p3 = new Parent("Marion");
    p3.getChildren().add( new Child("Gavin") );
    s.merge(p3);
    t.commit();
    s.close();

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

        }
    );
    s.beginTransaction();
    Image i = new Image();
    i.setName( "compincomp" );
    i = ( Image ) s.merge( i );
    assertNotNull( i.getDetails() );
    assertEquals( checkPerm, i.getDetails().getPerm1() );
    assertEquals( checkComment, i.getDetails().getComment() );
    s.getTransaction().commit();
    s.close();
View Full Code Here

    u.setPassword( "blah" );

    s = openSession( initiateInterceptor );
    t = s.beginTransaction();

    User merged = ( User ) s.merge( u );
    assertEquals( injectedString, merged.getInjectedString() );
    assertEquals( u.getName(), merged.getName() );
    assertEquals( u.getPassword(), merged.getPassword() );

    merged.setInjectedString( null );
View Full Code Here

    // load 'me' to associate it with the new session as a proxy (this may have occurred as 'prior work'
    // to the reattachment below)...
    Object meProxy = s.load( Parent.class, me.getName() );
    assertFalse( Hibernate.isInitialized( meProxy ) );
    // now, do the reattchment...
    s.merge( me );
    s.getTransaction().commit();
    s.close();

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