Package org.hibernate

Examples of org.hibernate.ScrollableResults.last()


      .setFetchSize( 10 )
      .scroll();
    scrollableResults.beforeFirst();
    // 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() );
View Full Code Here


 
  private int getResultNumberUsingScrollableResults(org.hibernate.Query hibernateQuery, Session session) {
    int resultNumber = 0;
    logger.debug("Scrolling query " + statement.getQueryString() + " ...");
    ScrollableResults scrollableResults = hibernateQuery.scroll();
    scrollableResults.last();
    logger.debug("Scrolled query " + statement.getQueryString());
    resultNumber = scrollableResults.getRowNumber() + 1; // Hibernate ScrollableResults row number starts with 0
    logger.debug("Number of fetched records: " + resultNumber + " for query " + statement.getQueryString());
    resultNumber = resultNumber < 0? 0: resultNumber;
    return resultNumber;
View Full Code Here

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

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

    assertTrue( results.first() );
View Full Code Here

      Object f4 = iter.get(0);
      assertTrue( f4!=null );
      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();
View Full Code Here

      f4 = iter.get(0);
      assertTrue( f4!=null );
      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 );
View Full Code Here

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

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

    for ( int i=1; i<3; i++ ) {
View Full Code Here

    results = hibQuery.scroll();
    results.first();
    Object[] result = results.get();
    assertEquals(1004, result[0]);

    results.last();
    result = results.get();
    assertEquals(1004, result[0]);

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
View Full Code Here

    Object f4 = iter.get(0);
    assertTrue( f4!=null );
    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();
View Full Code Here

    f4 = iter.get(0);
    assertTrue( f4!=null );
    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 );
View Full Code Here

    projections.next();
    Object[] projection = projections.get();
    checkProjectionFirst( projection, s );
    assertTrue( projections.isFirst() );

    projections.last();
    projection = projections.get();
    checkProjectionLast( projection, s );
    assertTrue( projections.isLast() );

    projections.next();
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.