Package org.hibernate

Examples of org.hibernate.Session.merge()


      node = ( Node ) it.next();
      assertEquals( "deliveryNodeB", node.getName() );
      deliveryNode = node;
    }

    deliveryNode = ( Node ) s.merge( deliveryNode );

    s.getTransaction().commit();
    s.close();

    assertInsertCount( 4 );
View Full Code Here


    clearCounts();

    Session s = openSession();
    s.beginTransaction();

    Tour tour = ( Tour ) s.merge( ( ( Node ) route.getNodes().toArray()[0]).getTour() );

    s.getTransaction().commit();
    s.close();

    assertInsertCount( 4 );
View Full Code Here

    }
    else {
      transport = ( Transport ) node.getDeliveryTransports().toArray()[0];
    }

    transport = ( Transport ) s.merge( transport  );

    s.getTransaction().commit();
    s.close();

    assertInsertCount( 4 );
View Full Code Here

    s.persist( boat );
    s.flush();
    s.clear();

    c1.addInventory( boat, 10, new BigDecimal( 5000 ) );
    s.merge( c1 );
    s.flush();
    s.clear();

    Customer c12 = ( Customer ) s.createQuery( "select c from Customer c" ).uniqueResult();
View Full Code Here

    tx.commit();

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

    // reattach by saveOrUpdate
    tx = s.beginTransaction();
    fb.setClub("Bimbo FC SA");
View Full Code Here

    container.setName( "another name" );

    session = openSession();
    session.beginTransaction();
    container = ( Container ) session.merge( container );
    session.getTransaction().commit();
    session.close();

    assertEquals( 1, container.getContents().size() );
    assertEquals( recreateCount, stats.getRecreateCount() );
View Full Code Here

    long recreateCount = stats.getRecreateCount();
    long updateCount = stats.getUpdateCount();

    session = openSession();
    session.beginTransaction();
    parent = ( Parent ) session.merge( parent );
    session.getTransaction().commit();
    session.close();

    assertEquals( 1, parent.getChildren().size() );
    assertEquals( recreateCount, stats.getRecreateCount() );
View Full Code Here

    s.setDefaultReadOnly( true );
    DataPoint dpProxy = ( DataPoint ) s.load( DataPoint.class, new Long( dp.getId() ) );
    assertTrue( s.isReadOnly( dpProxy ) );
    assertFalse( Hibernate.isInitialized( dpProxy ) );
    s.evict( dpProxy );
    dpProxy = ( DataPoint ) s.merge( dpProxy );
    assertTrue( s.isReadOnly( dpProxy ) );
    assertFalse( Hibernate.isInitialized( dpProxy ) );
    dpProxy = ( DataPoint ) s.merge( dp );
    assertTrue( s.isReadOnly( dpProxy ) );
    assertTrue( Hibernate.isInitialized( dpProxy ) );
View Full Code Here

    assertFalse( Hibernate.isInitialized( dpProxy ) );
    s.evict( dpProxy );
    dpProxy = ( DataPoint ) s.merge( dpProxy );
    assertTrue( s.isReadOnly( dpProxy ) );
    assertFalse( Hibernate.isInitialized( dpProxy ) );
    dpProxy = ( DataPoint ) s.merge( dp );
    assertTrue( s.isReadOnly( dpProxy ) );
    assertTrue( Hibernate.isInitialized( dpProxy ) );
    assertEquals( "description", dpProxy.getDescription() );
    s.evict( dpProxy );
    dpProxy = ( DataPoint ) s.merge( dpProxy );
View Full Code Here

    dpProxy = ( DataPoint ) s.merge( dp );
    assertTrue( s.isReadOnly( dpProxy ) );
    assertTrue( Hibernate.isInitialized( dpProxy ) );
    assertEquals( "description", dpProxy.getDescription() );
    s.evict( dpProxy );
    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 );
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.