Package org.hibernate.search

Examples of org.hibernate.search.FullTextSession.createQuery()


    hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    result = hibQuery.iterate();
    assertNotNull( result );
    assertFalse( result.hasNext() );

    for (Object element : s.createQuery( "from java.lang.Object" ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testScrollableResultSet() throws Exception {
View Full Code Here


    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();
    s.close();
  }

  // Technically this is checked by other tests but let's do it anyway. J.G.
View Full Code Here

    projections.next();
    assertTrue( projections.isFirst() );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testFetchSizeLargerThanHits() throws Exception {
View Full Code Here

    results.next();
    Object[] result = results.get();
    assertEquals( "incorrect entityInfo returned", 1000, result[0] );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testFetchSizeDefaultFirstAndMax() throws Exception {
View Full Code Here

    results.scroll( -2 );
    result = results.get();
    assertEquals( "incorrect entityInfo returned", 1002, result[0] );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testFetchSizeNonDefaultFirstAndMax() throws Exception {
View Full Code Here

    results.scroll( 10 );
    result = results.get();
    assertNull( result );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testFetchSizeNonDefaultFirstAndMaxNoHits() throws Exception {
View Full Code Here

    results.beforeFirst();
    Object[] result = results.get();
    assertNull( "non-null entity infos returned", result );

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testCurrent() throws Exception {
View Full Code Here

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

    //cleanup
    for (Object element : s.createQuery( "from " + Employee.class.getName() ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testMultipleEntityPerIndex() throws Exception {
View Full Code Here

    assertEquals( "Query with no class filter", 2, result.size() );
    for (Object element : result) {
      assertTrue( Hibernate.isInitialized( element ) );
      s.delete( element );
    }
    for (Object element : s.createQuery( "from java.lang.Object" ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testCriteria() throws Exception {
View Full Code Here

    //cleanup
    Author author = book.getAuthors().iterator().next();
    book.getAuthors().remove( author );

    for (Object element : s.createQuery( "from java.lang.Object" ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

  public void testScrollEmptyHits() throws Exception {
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.