Package org.hibernate

Examples of org.hibernate.Session.saveOrUpdate()


    boolean instrumented = FieldInterceptionHelper.isInstrumented( new NumberedNode() );

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

    assertInsertCount( 1 );
View Full Code Here


    assertUpdateCount( 0 );
    clearCounts();

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

    assertInsertCount( 0 );
View Full Code Here

    SimpleJtaTransactionManagerImpl.getInstance().begin();
    s = openSession();
    NumberedNode child = new NumberedNode( "child" );
    root.addChild( child );
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    root = ( NumberedNode ) getOldToNewEntityRefMap().get( root );
    assertTrue( Hibernate.isInitialized( root.getChildren() ) );
    child = ( NumberedNode ) root.getChildren().iterator().next();
    assertTrue( s.contains( child ) );
View Full Code Here

    root.addChild( secondChild );

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

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

  public void testSaveOrUpdateGotWithMutableProp() throws Exception {
    SimpleJtaTransactionManagerImpl.getInstance().begin();
    Session s = openSession();
    Node root = new Node( "root" );
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    root = ( Node ) getOldToNewEntityRefMap().get( root );
    SimpleJtaTransactionManagerImpl.getInstance().commit();

    assertInsertCount( 1 );
View Full Code Here

    assertUpdateCount( 0 );
    clearCounts();

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

    assertInsertCount( 0 );
View Full Code Here

    SimpleJtaTransactionManagerImpl.getInstance().begin();
    s = openSession();
    Node child = new Node( "child" );
    root.addChild( child );
    s.saveOrUpdate( root );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    root = ( Node ) getOldToNewEntityRefMap().get( root );
    child = ( Node ) root.getChildren().iterator().next();
    assertTrue( s.contains( child ) );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
View Full Code Here

    Session s = openSession();
    Transaction tx = s.beginTransaction();
    NumberedNode root = new NumberedNode( "root" );
    NumberedNode child = new NumberedNode( "child" );
    root.addChild( child );
    s.saveOrUpdate( root );
    tx.commit();
    s.close();

    assertInsertCount( 2 );
    clearCounts();
View Full Code Here

    root.addChild( secondChild );

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

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

    Node parent = new Node( "1:parent" );
    Node child = new Node( "2:child" );
    Node grandchild = new Node( "3:grandchild" );
    parent.addChild( child );
    child.addChild( grandchild );
    s.saveOrUpdate( parent );
    s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
    SimpleJtaTransactionManagerImpl.getInstance().commit();

    SimpleJtaTransactionManagerImpl.getInstance().begin();
    Session s1 = openSession();
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.