Package org.hibernate

Examples of org.hibernate.ScrollableResults.beforeFirst()


    assertNull( projection );

    hibQuery = s.createFullTextQuery( query, Employee.class ).setFirstResult( 10 ).setMaxResults( 20 );

    projections = hibQuery.scroll();
    projections.beforeFirst();
    projections.next();
    projection = projections.get();
    assertNull( projection );

    //cleanup
View Full Code Here


      .setMaxResults( 111 )
      .scroll();
    assertEquals( -1, scrollableResults.getRowNumber() );
    assertTrue( scrollableResults.last() );
    assertEquals( 110, scrollableResults.getRowNumber() );
    scrollableResults.beforeFirst();
    int position = scrollableResults.getRowNumber();
    while ( scrollableResults.next() ) {
      position++;
      int bookId = position + 20;
      assertEquals( position, scrollableResults.getRowNumber() );
View Full Code Here

    ScrollableResults scrollableResults = sess
      .createFullTextQuery( tq, AlternateBook.class )
      .setSort( sort )
      .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 );
View Full Code Here

          )
      .setFetchSize( 10 )
      .scroll();
    scrollableResults.last();
    assertEquals( 132, scrollableResults.getRowNumber() );
    scrollableResults.beforeFirst();
    assertEquals( -1, scrollableResults.getRowNumber() );
    int position = scrollableResults.getRowNumber();
    while ( scrollableResults.next() ) {
      position++;
      Object[] objs = scrollableResults.get();
View Full Code Here

    query = parser.parse( "summary:Festina Or brand:Seiko" );
    hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    result = hibQuery.scroll();
    assertEquals( -1, result.getRowNumber() );
    result.beforeFirst();
    assertEquals( true, result.next() );
    assertTrue( result.isFirst() );
    assertTrue( result.scroll( 1 ) );
    assertTrue( result.isLast() );
    assertFalse( result.scroll( 1 ) );
View Full Code Here

    assertEquals( true, result.next() );
    assertTrue( result.isFirst() );
    assertTrue( result.scroll( 1 ) );
    assertTrue( result.isLast() );
    assertFalse( result.scroll( 1 ) );
    result.beforeFirst();
    while ( result.next() ) {
      s.delete( result.get()[0] );
    }
    for (Object element : s.createQuery( "from java.lang.Object" ).list()) s.delete( element );
    tx.commit();
View Full Code Here

    Query query = parser.parse( "dept:ITech" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Employee.class );
    hibQuery.setProjection( "id", "lastname", "dept" );

    ScrollableResults projections = hibQuery.scroll();
    projections.beforeFirst();
    Object[] projection = projections.get();
    assertNull( projection );

    projections.next();
    assertTrue( projections.isFirst() );
View Full Code Here

    ScrollableResults projections = hibQuery.scroll();

    // There are a lot of methods to check in ScrollableResultsImpl
    // so, we'll use methods to check each projection as needed.

    projections.beforeFirst();
    projections.next();
    Object[] projection = projections.get();
    checkProjectionFirst( projection, s );
    assertTrue( projections.isFirst() );
View Full Code Here

      .setMaxResults( 111 )
      .scroll();
    assertEquals( -1, scrollableResults.getRowNumber() );
    assertTrue( scrollableResults.last() );
    assertEquals( 110, scrollableResults.getRowNumber() );
    scrollableResults.beforeFirst();
    int position = scrollableResults.getRowNumber();
    while ( scrollableResults.next() ) {
      position++;
      int bookId = position + 20;
      assertEquals( position, scrollableResults.getRowNumber() );
View Full Code Here

    ScrollableResults scrollableResults = sess
      .createFullTextQuery( tq, AlternateBook.class )
      .setSort( sort )
      .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 );
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.