Package org.hibernate

Examples of org.hibernate.Session.saveOrUpdate()


    s1.evict( child.getParent() );
    assertFalse( s1.contains( child.getParent() ) );

    s2 = openSession();
    s2.getTransaction().begin();
    s2.saveOrUpdate( child );
    assertTrue( s2.contains( child ) );
    assertFalse( s1.contains( child ) );
    assertTrue( s2.contains( child.getParent() ) );
    assertFalse( s1.contains( child.getParent() ) );
    assertFalse( Hibernate.isInitialized( child.getChildren() ) );
View Full Code Here


    Node root = new Node( "root" );
    Node child = new Node( "child" );
    Node grandchild = new Node( "grandchild" );
    root.addChild( child );
    child.addChild( grandchild );
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    root = ( Node ) getOldToNewEntityRefMap().get( root );
    child = ( Node ) getOldToNewEntityRefMap().get( child );
    grandchild = ( Node ) getOldToNewEntityRefMap().get( grandchild );
    SimpleJtaTransactionManagerImpl.getInstance().commit();
View Full Code Here

    Node grandchild2 = new Node( "grandchild2" );
    child.addChild( grandchild2 );

    SimpleJtaTransactionManagerImpl.getInstance().begin();
    s = openSession();
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    root = ( Node ) getOldToNewEntityRefMap().get( root );
    SimpleJtaTransactionManagerImpl.getInstance().commit();

    assertInsertCount( 1 );
View Full Code Here

    child2.addChild( grandchild3 );
    root.addChild( child2 );

    SimpleJtaTransactionManagerImpl.getInstance().begin();
    s = openSession();
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    SimpleJtaTransactionManagerImpl.getInstance().commit();

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

    NumberedNode root = new NumberedNode( "root" );
    NumberedNode child = new NumberedNode( "child" );
    NumberedNode grandchild = new NumberedNode( "grandchild" );
    root.addChild( child );
    child.addChild( grandchild );
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    root = ( NumberedNode ) getOldToNewEntityRefMap().get( root );
    child = ( NumberedNode ) getOldToNewEntityRefMap().get( child );
    grandchild = ( NumberedNode ) getOldToNewEntityRefMap().get( grandchild );
    SimpleJtaTransactionManagerImpl.getInstance().commit();
View Full Code Here

    Node root = new Node( "root" );
    Node child = new Node( "child" );
    Node grandchild = new Node( "grandchild" );
    root.addChild( child );
    child.addChild( grandchild );
    s.saveOrUpdate( root );
    tx.commit();
    s.close();

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

    NumberedNode grandchild2 = new NumberedNode( "grandchild2" );
    child.addChild( grandchild2 );

    SimpleJtaTransactionManagerImpl.getInstance().begin();
    s = openSession();
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    root = ( NumberedNode ) getOldToNewEntityRefMap().get( root );
    SimpleJtaTransactionManagerImpl.getInstance().commit();

    assertInsertCount( 1 );
View Full Code Here

    child2.addChild( grandchild3 );
    root.addChild( child2 );

    SimpleJtaTransactionManagerImpl.getInstance().begin();
    s = openSession();
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    SimpleJtaTransactionManagerImpl.getInstance().commit();

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

    Node grandchild2 = new Node( "grandchild2" );
    child.addChild( grandchild2 );

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

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

    child2.addChild( grandchild3 );
    root.addChild( child2 );

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

    assertInsertCount( 2 );
    assertUpdateCount( 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.