Package org.hibernate

Examples of org.hibernate.ScrollableResults.previous()


      }
    }
    //verifies it did scroll to the end:
    assertEquals( 323, position );
    //assert the entities are re-attached after eviction:
    while ( scrollableResults.previous() ) {
      position--;
      AlternateBook book = (AlternateBook) scrollableResults.get()[0];
      assertTrue( sess.contains( book ) );
    }
    assertEquals( -1, position );
View Full Code Here


      }
    }
    //verify we scrolled to the end:
    assertEquals( 132, position );
    // and now the other way around, checking entities are attached again:
    while ( scrollableResults.previous() ) {
      position--;
      Object[] objs = scrollableResults.get();
      assertTrue( objs[2] instanceof Employee );
      sess.contains( objs[2] );
      assertTrue( objs[4] instanceof Employee );
View Full Code Here

    projections.next();
    projection = projections.get();
    assertNull( projection );

    projections.previous();
    projection = projections.get();
    checkProjectionLast( projection, s );

    projections.first();
    projection = projections.get();
View Full Code Here

    // initial position should be -1 as in Hibernate Core
    assertEquals( -1, scrollableResults.getRowNumber() );
    assertTrue( scrollableResults.last() );
    int position = scrollableResults.getRowNumber();
    assertEquals( 323, position );
    while ( scrollableResults.previous() ) {
      AlternateBook book = (AlternateBook) scrollableResults.get()[0];
      assertEquals( --position, book.getId().intValue() );
      assertEquals( "book about the number " + position, book.getSummary() );
    }
    assertEquals( 0, position );
View Full Code Here

            .scroll();

    results.afterLast();

    int counter = 0;
    while ( results.previous() ) {
      counter++;
      Animal animal = ( Animal ) results.get( 0 );
      checkResult( animal );
    }
    assertEquals( "unexpected result count", 2, counter );
View Full Code Here

      assertTrue( !iter.next() );
      assertTrue( iter.first() );
      assertTrue( iter.get(0)==f1 );
      assertTrue( iter.last() );
      assertTrue( iter.get(0)==f4 );
      assertTrue( iter.previous() );
      txn.commit();
      s.close();

      s = openSession();
      txn = s.beginTransaction();
View Full Code Here

      assertTrue( !iter.next() );
      assertTrue( iter.first() );
      assertTrue( iter.get(0)==f1 );
      assertTrue( iter.last() );
      assertTrue( iter.get(0)==f4 );
      assertTrue( iter.previous() );
      assertTrue( s.delete("from Foo")==4 );
      s.flush();
      assertTrue( s.find("from java.lang.Object").size()==0 );
      txn.commit();
      s.close();
View Full Code Here

    assertFalse( results.next() );
    assertFalse( results.isFirst() );
    assertFalse( results.isLast() );

    assertFalse( results.previous() );
    assertFalse( results.isFirst() );
    assertFalse( results.isLast() );

    results.beforeFirst();
    assertFalse( results.isFirst() );
View Full Code Here

            .setString( "desc", "root%" )
            .scroll();

    assertFalse( results.isFirst() );
    assertFalse( results.isLast() );
    assertFalse( results.previous() );   

    assertTrue( results.next() );
    assertTrue( results.isFirst() );
    assertTrue( results.isLast() );
View Full Code Here

    assertFalse( results.next() );
    assertFalse( results.isFirst() );
    assertFalse( results.isLast() );

    assertTrue( results.previous() );
    assertTrue( results.isFirst() );
    assertTrue( results.isLast() );

    assertFalse( results.previous() );
    assertFalse( results.isFirst() );
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.