Package org.hibernate

Examples of org.hibernate.Session.load()


    assertUpdateCount( 0 );
    clearCounts();

    s = openSession();
    s.beginTransaction();
    dp = ( DataPoint ) s.load( DataPoint.class, new Long( dpId ) );
    assertFalse( "was initialized", Hibernate.isInitialized( dp ) );
    s.setReadOnly( dp, true );
    assertFalse( "was initialized during setReadOnly", Hibernate.isInitialized( dp ) );
    dp.setDescription( "changed" );
    assertTrue( "was not initialized during mod", Hibernate.isInitialized( dp ) );
View Full Code Here


    PurchaseRecord toLoad = new PurchaseRecord();
   
    s = openSession();
    t = s.beginTransaction();

    s.load(toLoad, id);
   
    t.commit();
    s.close();
   
    // show that the correct timestamp and ids were loaded
View Full Code Here

    Long aid = a.getId();
    Long bid = b.getId();

    s = openSession();
    t = s.beginTransaction();
    b = ( Bid ) s.load( Bid.class, bid );
    assertFalse( Hibernate.isInitialized( b ) );
    a = ( Auction ) s.get( Auction.class, aid );
    assertFalse( Hibernate.isInitialized( a.getBids() ) );
    assertTrue( Hibernate.isInitialized( a.getSuccessfulBid() ) );
    assertSame( a.getBids().iterator().next(), b );
View Full Code Here

    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    b = ( Bid ) s.load( Bid.class, bid );
    assertFalse( Hibernate.isInitialized( b ) );
    a = ( Auction ) s.createQuery( "from Auction a left join fetch a.bids" ).uniqueResult();
    assertTrue( Hibernate.isInitialized( b ) );
    assertTrue( Hibernate.isInitialized( a.getBids() ) );
    assertSame( b, a.getSuccessfulBid() );
View Full Code Here

    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    b = ( Bid ) s.load( Bid.class, bid );
    a = ( Auction ) s.load( Auction.class, aid );
    assertFalse( Hibernate.isInitialized( b ) );
    assertFalse( Hibernate.isInitialized( a ) );
    s.createQuery( "from Auction a left join fetch a.successfulBid" ).list();
    assertTrue( Hibernate.isInitialized( b ) );
View Full Code Here

    s.close();

    s = openSession();
    t = s.beginTransaction();
    b = ( Bid ) s.load( Bid.class, bid );
    a = ( Auction ) s.load( Auction.class, aid );
    assertFalse( Hibernate.isInitialized( b ) );
    assertFalse( Hibernate.isInitialized( a ) );
    s.createQuery( "from Auction a left join fetch a.successfulBid" ).list();
    assertTrue( Hibernate.isInitialized( b ) );
    assertTrue( Hibernate.isInitialized( a ) );
View Full Code Here

    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    b = ( Bid ) s.load( Bid.class, bid );
    a = ( Auction ) s.load( Auction.class, aid );
    assertFalse( Hibernate.isInitialized( b ) );
    assertFalse( Hibernate.isInitialized( a ) );
    assertSame( s.get( Bid.class, bid ), b );
    assertTrue( Hibernate.isInitialized( b ) );
View Full Code Here

    s.close();

    s = openSession();
    t = s.beginTransaction();
    b = ( Bid ) s.load( Bid.class, bid );
    a = ( Auction ) s.load( Auction.class, aid );
    assertFalse( Hibernate.isInitialized( b ) );
    assertFalse( Hibernate.isInitialized( a ) );
    assertSame( s.get( Bid.class, bid ), b );
    assertTrue( Hibernate.isInitialized( b ) );
    assertSame( s.get( Auction.class, aid ), a );
View Full Code Here

    s = openSession();
    s.setCacheMode(CacheMode.IGNORE);
    t = s.beginTransaction();
    s.setDefaultReadOnly( true );
    dp = ( DataPoint ) s.load( DataPoint.class, dp.getId() );
    assertTrue( s.isReadOnly( dp ) );
    assertFalse( Hibernate.isInitialized( dp ) );
    s.refresh( dp );
    assertFalse( Hibernate.isInitialized( dp ) );
    assertTrue( s.isReadOnly( dp ) );
View Full Code Here

    s = openSession();
    s.setCacheMode(CacheMode.IGNORE);
    t = s.beginTransaction();
    s.setDefaultReadOnly( true );
    dp = ( DataPoint ) s.load( DataPoint.class, dp.getId() );
    assertFalse( Hibernate.isInitialized( dp ) );
    assertTrue( s.isReadOnly( dp ) );
    s.evict( dp );
    s.refresh( dp );
    assertFalse( Hibernate.isInitialized( 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.