Package org.hibernate.stat

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


    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    stats.clear();
    europe = fillDb(s);
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
    assertEquals( 0, stats.getCollectionLoadCount() );
View Full Code Here


    Collection coll = getCfg().getCollectionMapping(Continent.class.getName() + ".countries");
    coll.setFetchMode(FetchMode.JOIN);
    coll.setLazy(false);
    SessionFactory sf = getCfg().buildSessionFactory();
    stats = sf.getStatistics();
    stats.clear();
    stats.setStatisticsEnabled(true);
    s = sf.openSession();
    tx = s.beginTransaction();
    europe = fillDb(s);
    tx.commit();
View Full Code Here

    coll = getCfg().getCollectionMapping(Continent.class.getName() + ".countries");
    coll.setFetchMode(FetchMode.SELECT);
    coll.setLazy(false);
    sf = getCfg().buildSessionFactory();
    stats = sf.getStatistics();
    stats.clear();
    stats.setStatisticsEnabled(true);
    s = sf.openSession();
    tx = s.beginTransaction();
    europe = fillDb(s);
    tx.commit();
View Full Code Here

    s.close();
  }

  public void testQueryStatGathering() {
    Statistics stats = getSessions().getStatistics();
    stats.clear();

    Session s = openSession();
    Transaction tx = s.beginTransaction();
    fillDb(s);
    tx.commit();
View Full Code Here

    tx.commit();
    s.close();

    // explicitly check that statistics for "split queries" get collected
    // under the original query
    stats.clear();
    s = openSession();
    tx = s.beginTransaction();
    final String localities = "from Locality";
    results = s.createQuery( localities ).list().size();
    QueryStatistics localityStats = stats.getQueryStatistics( localities );
View Full Code Here

    tx.commit();
    s.close();
    assertFalse( s.isOpen() );

    // native sql queries
    stats.clear();
    s = openSession();
    tx = s.beginTransaction();
    final String sql = "select id, name from Country";
    results = s.createSQLQuery( sql ).addEntity( Country.class ).list().size();
    QueryStatistics sqlStats = stats.getQueryStatistics( sql );
View Full Code Here

    if ( ! supportsCircularCascadeDelete() ) {
      return;
    }

    Statistics statistics = getSessions().getStatistics();
    statistics.clear();
   
    Session s = openSession();
    Transaction t = s.beginTransaction();
   
    Salesperson mark = new Salesperson();
View Full Code Here

    t.commit();
   
    assertEquals( statistics.getEntityInsertCount(), 2 );
    assertEquals( statistics.getPrepareStatementCount(), 5 );
   
    statistics.clear();
   
    t = s.beginTransaction();
    s.delete(mark);
    t.commit();
View Full Code Here

    q = s.getNamedQuery( "night.moreRecentThan" );
    q.setDate( "date", inAMonth );
    assertEquals( 0, q.list().size() );
    Statistics stats = getSessions().getStatistics();
    stats.setStatisticsEnabled( true );
    stats.clear();
    q = s.getNamedQuery( "night.duration" );
    q.setParameter( "duration", 14l );
    assertEquals( 1, q.list().size() );
    assertEquals( 1, stats.getQueryCachePutCount() );
    q = s.getNamedQuery( "night.duration" );
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

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.