Package org.hibernate.search

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


    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

    projections.next();
    projection = projections.get();
    assertNull( projection );

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

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

    hibQuery = s.createFullTextQuery( query, Employee.class ).setFirstResult( 10 ).setMaxResults( 20 );
    result = hibQuery.list();
    assertEquals( 0, result.size() );

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

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

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

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

  private void prepEmployeeIndex(FullTextSession s) {
View Full Code Here

    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

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.