Package org.hibernate.search

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


    contact.getPhoneNumbers().clear();
    contact.getAddresses().clear();
    s.flush();
    s.clear();
    s.createQuery( "delete " + Address.class.getName() ).executeUpdate();
    s.createQuery( "delete " + Phone.class.getName() ).executeUpdate();
    s.createQuery( "delete " + Contact.class.getName() ).executeUpdate();
    s.getTransaction().commit();

    s.close();
  }
View Full Code Here


    contact.getAddresses().clear();
    s.flush();
    s.clear();
    s.createQuery( "delete " + Address.class.getName() ).executeUpdate();
    s.createQuery( "delete " + Phone.class.getName() ).executeUpdate();
    s.createQuery( "delete " + Contact.class.getName() ).executeUpdate();
    s.getTransaction().commit();

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

      assertEquals( "DOCUMENT size incorrect", 4, ( ( Document ) projection[5] ).getFields().size() );
    }
    assertEquals( "incorrect number of results returned", 4, counter );

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

    assertEquals( "dept incorrect", "Accounting", projection[7] );
    assertNotNull( "Date", projection[8] );
    assertNotNull( "Lucene internal doc id", projection[9] );

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

    assertTrue( "THIS incorrect", projection[0] instanceof Employee );
    assertTrue( "SCORE incorrect", projection[1] instanceof Float );
    assertEquals( "last name incorrect", "Jackson", projection[3] );

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

    assertEquals( 1, result.size() );
    projection = ( Object[] ) result.get( 0 );
    assertEquals( "mainAuthor.name", null, projection[2] );

    //cleanup
    for ( Object element : s.createQuery( "from " + Book.class.getName() ).list() ) {
      s.delete( element );
    }
    for ( Object element : s.createQuery( "from " + Author.class.getName() ).list() ) {
      s.delete( element );
    }
View Full Code Here

    //cleanup
    for ( Object element : s.createQuery( "from " + Book.class.getName() ).list() ) {
      s.delete( element );
    }
    for ( Object element : s.createQuery( "from " + Author.class.getName() ).list() ) {
      s.delete( element );
    }
    tx.commit();
    s.close();
  }
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.