Package org.hibernate

Examples of org.hibernate.Session.refresh()


    customer.setName( "Steve" );
    session = openSession();
    session.beginTransaction();
    session.update( customer );
    session.flush();
    session.refresh( customer );
    assertEquals( "name not updated", "Steve", customer.getName() );
    session.getTransaction().commit();
    session.close();

    // Test querying
View Full Code Here


    dp = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
    s.setReadOnly( dp, true );
    assertEquals( "original", dp.getDescription() );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.refresh( dp );
    assertEquals( "original", dp.getDescription() );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    t.commit();
View Full Code Here

    dp = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
    s.setReadOnly( dp, true );
    assertEquals( "original", dp.getDescription() );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.refresh( dp );
    assertEquals( "original", dp.getDescription() );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    t.commit();
View Full Code Here

    s = openSession();
    t = s.beginTransaction();
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.refresh( dp );
    assertEquals( "original", dp.getDescription() );
    assertFalse( s.isReadOnly( dp ) );
    s.setReadOnly( dp, true );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
View Full Code Here

    assertFalse( s.isReadOnly( dp ) );
    s.setReadOnly( dp, true );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.evict( dp );
    s.refresh( dp );
    assertEquals( "original", dp.getDescription() );
    assertFalse( s.isReadOnly( dp ) );
    t.commit();

    assertInsertCount( 0 );
View Full Code Here

    dp = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
    assertTrue( s.isReadOnly( dp ) );
    assertEquals( "original", dp.getDescription() );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.refresh( dp );
    assertTrue( s.isReadOnly( dp ) );
    assertEquals( "original", dp.getDescription() );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.setDefaultReadOnly( false );
View Full Code Here

    assertTrue( s.isReadOnly( dp ) );
    assertEquals( "original", dp.getDescription() );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.setDefaultReadOnly( false );
    s.refresh( dp );
    assertTrue( s.isReadOnly( dp ) );
    assertEquals( "original", dp.getDescription() );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    t.commit();
View Full Code Here

    s.setCacheMode(CacheMode.IGNORE);
    t = s.beginTransaction();
    s.setDefaultReadOnly( false );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.refresh( dp );
    assertEquals( "original", dp.getDescription() );
    assertFalse( s.isReadOnly( dp ) );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.evict( dp );
View Full Code Here

    assertEquals( "original", dp.getDescription() );
    assertFalse( s.isReadOnly( dp ) );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.evict( dp );
    s.refresh( dp );
    assertEquals( "original", dp.getDescription() );
    assertFalse( s.isReadOnly( dp ) );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.setDefaultReadOnly( true );
View Full Code Here

    assertFalse( s.isReadOnly( dp ) );
    dp.setDescription( "changed" );
    assertEquals( "changed", dp.getDescription() );
    s.setDefaultReadOnly( true );
    s.evict( dp );
    s.refresh( dp );
    assertEquals( "original", dp.getDescription() );
    assertTrue( s.isReadOnly( dp ) );
    dp.setDescription( "changed" );
    t.commit();
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.