Package org.hibernate

Examples of org.hibernate.ScrollableResults.previous()


    results.next();
    assertTrue("large negative scroll() pointer incorrect", results.isFirst());

    // And test a bad forward scroll.
    results.scroll( 10 );
    results.previous();
    assertTrue("large positive scroll() pointer incorrect", results.isLast());

    // Finally, let's test a REAL screwup.
    hibQuery.setFirstResult( 3 );
    hibQuery.setMaxResults( 1 );
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

      }
    }
    //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

      }
    }
    //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

    results.beforeFirst();
    results.next();
    assertTrue( "beforeFirst() pointer incorrect", results.isFirst() );

    results.afterLast();
    results.previous();
    assertTrue( "afterLast() pointer incorrect", results.isLast() );

    // Let's see if a bad reverse scroll screws things up
    results.scroll( -8 );
    results.next();
View Full Code Here

    results.next();
    assertTrue( "large negative scroll() pointer incorrect", results.isFirst() );

    // And test a bad forward scroll.
    results.scroll( 10 );
    results.previous();
    assertTrue( "large positive scroll() pointer incorrect", results.isLast() );

    // Finally, let's test a REAL screwup.
    hibQuery.setFirstResult( 3 );
    hibQuery.setMaxResults( 1 );
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.