Package org.hibernate.stat

Examples of org.hibernate.stat.Statistics.clear()


    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

    Query query = parser.parse( "summary:Festina Or brand:Seiko" );
    Statistics stats = s.getSessionFactory().getStatistics();
    stats.clear();
    boolean enabled = stats.isStatisticsEnabled();
    if ( !enabled ) stats.setStatisticsEnabled( true );
    FullTextQuery hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    assertEquals( "Exection of getResultSize without actual results", 2, hibQuery.getResultSize() );
    assertEquals( "No entity should be loaded", 0, stats.getEntityLoadCount() );
View Full Code Here


    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

    Query query = parser.parse( "summary:Festina Or brand:Seiko" );
    Statistics stats = s.getSessionFactory().getStatistics();
    stats.clear();
    boolean enabled = stats.isStatisticsEnabled();
    if ( !enabled ) stats.setStatisticsEnabled( true );
    FullTextQuery hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    assertEquals( "Exection of getResultSize without actual results", 2, hibQuery.getResultSize() );
    assertEquals( "No entity should be loaded", 0, stats.getEntityLoadCount() );
View Full Code Here

    Transaction tx = fullTextSession.beginTransaction();
    QueryParser parser = new QueryParser( TestConstants.getTargetLuceneVersion(), "title", TestConstants.stopAnalyzer );

    Query query = parser.parse( "summary:Festina Or brand:Seiko" );
    Statistics stats = fullTextSession.getSessionFactory().getStatistics();
    stats.clear();
    boolean enabled = stats.isStatisticsEnabled();
    if ( !enabled ) {
      stats.setStatisticsEnabled( true );
    }
    FullTextQuery hibQuery = fullTextSession.createFullTextQuery( query, Clock.class, Book.class );
View Full Code Here

  @Test
  public void testStaleCacheWithAsyncIndexer() {
    Session session = openSession();
    final Statistics statistics = session.getSessionFactory().getStatistics();
    statistics.clear();
    statistics.setStatisticsEnabled( true );
    setData( session, statistics );

    GatedLuceneBackend.open.set( false ); // disable processing of index updates
    Transaction tx = session.beginTransaction();
View Full Code Here

  @Test
  public void testQueryWoLookup() throws Exception {
    Session session = openSession();
    final Statistics statistics = session.getSessionFactory().getStatistics();
    statistics.clear();
    statistics.setStatisticsEnabled( true );
    setData( session, statistics );

    session.clear();
View Full Code Here

  @Test
  public void testQueryWith2LCLookup() throws Exception {
    Session session = openSession();
    final Statistics statistics = session.getSessionFactory().getStatistics();
    statistics.clear();
    statistics.setStatisticsEnabled( true );
    setData( session, statistics );

    session.clear();
View Full Code Here

  @Test
  public void testQueryWithPCLookup() throws Exception {
    Session session = openSession();
    final Statistics statistics = session.getSessionFactory().getStatistics();
    statistics.clear();
    statistics.setStatisticsEnabled( true );
    setData( session, statistics );

    session.clear();
View Full Code Here

    session.clear();

    Transaction transaction = session.beginTransaction();
    final FullTextSession fullTextSession = Search.getFullTextSession( session );
    session.createQuery( "from " + Kernel.class.getName() ).list();
    statistics.clear();
    final QueryBuilder queryBuilder = fullTextSession.getSearchFactory()
        .buildQueryBuilder()
        .forEntity( Kernel.class )
        .get();
    final Query luceneQuery = queryBuilder.keyword().onField( "product" ).matching( "Polgeiser" ).createQuery();
View Full Code Here

  @Test
  public void testQueryWithPCAndCacheLookup() throws Exception {
    Session session = openSession();
    final Statistics statistics = session.getSessionFactory().getStatistics();
    statistics.clear();
    statistics.setStatisticsEnabled( true );
    setData( session, statistics );

    session.clear();
View Full Code Here

    Transaction transaction = session.beginTransaction();
    final FullTextSession fullTextSession = Search.getFullTextSession( session );
    //load just one object into persistence context:
    List firstLoad = session.createQuery( "from Kernel k where k.codeName = 'coconut'" ).list();
    assertThat( firstLoad.size() ).isEqualTo( 1 );
    statistics.clear();
    final QueryBuilder queryBuilder = fullTextSession.getSearchFactory()
        .buildQueryBuilder()
        .forEntity( Kernel.class )
        .get();
    final Query luceneQuery = queryBuilder.keyword().onField( "product" ).matching( "Polgeiser" ).createQuery();
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.