Package org.hibernate.search

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


    hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    results = hibQuery.list();
    assertEquals("incorrect test record count", 1, results.size());
    assertEquals("incorrect test record", 2, ((Clock)results.get( 0 )).getId().intValue());

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

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


    query = parser.parse( "summary:Festina or summary:gloire" );
    hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    results = hibQuery.list();
    assertEquals("incorrect class purged", 2, results.size());

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

  protected Class[] getMappings() {
View Full Code Here

    hibQuery = s.createFullTextQuery( query );
    result = hibQuery.list();
    assertNotNull( result );
    assertEquals( "Query with delete objects", 0, result.size() );

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

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

    hibQuery = s.createFullTextQuery( query );
    List result = hibQuery.list();
    assertNotNull( result );
    assertEquals( "2 entities should be loaded", 2, stats.getEntityLoadCount() );
    if ( !enabled ) stats.setStatisticsEnabled( false );
    for (Object element : s.createQuery( "from java.lang.Object" ).list()) s.delete( element );
    tx.commit();
    s.close();
  }

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

    hibQuery.setMaxResults( 3 );
    result = hibQuery.list();
    assertNotNull( result );
    assertEquals( "first result out of limit", 0, result.size() );

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

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

    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

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.