Examples of initializeObjectsWith()


Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

        .buildQueryBuilder()
        .forEntity( Insurance.class )
        .get();
    final Query lq = b.keyword().onField( "name" ).matching( "Macif" ).createQuery();
    final FullTextQuery ftQuery = fts.createFullTextQuery( lq, Insurance.class );
    ftQuery.initializeObjectsWith( ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID );
    final List<Insurance> resultList = ftQuery.list();
    assertThat( resultList ).hasSize( 1 );
    for ( Object e : resultList ) {
      fts.delete( e );
    }
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

    fullTextQuery.setSort( parsingResult.getSort() );

    // Following options are mandatory to load matching entities without using a query
    // (chicken and egg problem)
    fullTextQuery.initializeObjectsWith( ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID );

    if ( queryParameters.getRowSelection().getFirstRow() != null ) {
      fullTextQuery.setFirstResult( queryParameters.getRowSelection().getFirstRow() );
    }
    if ( queryParameters.getRowSelection().getMaxRows() != null ) {
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

    fullTextQuery.setSort( parsingResult.getSort() );

    // Following options are mandatory to load matching entities without using a query
    // (chicken and egg problem)
    fullTextQuery.initializeObjectsWith( ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID );
    return fullTextQuery;
  }

  private boolean requiresProjections(List<String> projections) {
    if ( projections.size() == 0 ) {
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

      org.apache.lucene.search.Query luceneQuery = walker.getLuceneQuery();
      Class targetEntity = walker.getTargetEntity();
      FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( luceneQuery, targetEntity );
      //Following options are mandatory to load matching entities without using a query
      //(chicken and egg problem)
      fullTextQuery.initializeObjectsWith( ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID );
      return fullTextQuery;
    }
    catch (RecognitionException e) {
      throw new HibernateException( "Invalid query syntax", e );
    }
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

        .buildQueryBuilder()
        .forEntity( Kernel.class )
        .get();
    final Query luceneQuery = queryBuilder.keyword().onField( "product" ).matching( "Polgeiser" ).createQuery();
    final FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( luceneQuery, Kernel.class );
    fullTextQuery.initializeObjectsWith( ObjectLookupMethod.SECOND_LEVEL_CACHE, DatabaseRetrievalMethod.QUERY );
    List list = fullTextQuery.list();
    assertThat( list.size() ).isEqualTo( 2 );
    assertThat( statistics.getSecondLevelCacheHitCount() )
      .isEqualTo( 2 );
    assertThat( statistics.getQueryExecutionCount() )
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

        .buildQueryBuilder()
        .forEntity( Kernel.class )
        .get();
    final Query luceneQuery = queryBuilder.keyword().onField( "product" ).matching( "Polgeiser" ).createQuery();
    final FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( luceneQuery, Kernel.class );
    fullTextQuery.initializeObjectsWith( ObjectLookupMethod.PERSISTENCE_CONTEXT, DatabaseRetrievalMethod.QUERY );
    List list = fullTextQuery.list();
    assertThat( list.size() ).isEqualTo( 2 );
    assertThat( statistics.getSecondLevelCacheHitCount() )
      .isEqualTo( 0 );
    assertThat( statistics.getQueryExecutionCount() )
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

        .buildQueryBuilder()
        .forEntity( Kernel.class )
        .get();
    final Query luceneQuery = queryBuilder.keyword().onField( "product" ).matching( "Polgeiser" ).createQuery();
    final FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( luceneQuery, Kernel.class );
    fullTextQuery.initializeObjectsWith( ObjectLookupMethod.SECOND_LEVEL_CACHE, DatabaseRetrievalMethod.QUERY );
    List list = fullTextQuery.list();
    assertThat( list.size() ).isEqualTo( 2 );
    assertThat( statistics.getSecondLevelCacheHitCount() )
      .isEqualTo( 1 );
    assertThat( statistics.getQueryExecutionCount() )
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

        .buildQueryBuilder()
        .forEntity( Kernel.class )
        .get();
    final Query luceneQuery = queryBuilder.keyword().onField( "product" ).matching( "Polgeiser" ).createQuery();
    final FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( luceneQuery, Kernel.class );
    fullTextQuery.initializeObjectsWith( ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID );
    List list = fullTextQuery.list();
    assertThat( list.size() ).isEqualTo( 2 );
    for ( Object o : list ) {
      assertThat( o ).satisfies( new Condition<Object>() {
        @Override
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

      fullTextQuery.setProjection( parsingResult.getProjections().toArray( new String[parsingResult.getProjections().size()] ) );
    }

    // Following options are mandatory to load matching entities without using a query
    // (chicken and egg problem)
    fullTextQuery.initializeObjectsWith( ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID );
    return fullTextQuery;
  }

  private boolean requiresProjections(List<String> projections) {
    if ( projections.size() == 0 ) {
View Full Code Here

Examples of org.hibernate.search.FullTextQuery.initializeObjectsWith()

    fullTextQuery.setSort( parsingResult.getSort() );

    // Following options are mandatory to load matching entities without using a query
    // (chicken and egg problem)
    fullTextQuery.initializeObjectsWith( ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID );
    return fullTextQuery;
  }

  private boolean requiresProjections(List<String> projections) {
    if ( projections.size() == 0 ) {
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.