Package org.hibernate.stat

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


    s.close();
  }

  public void testSQLQueryWithManyToOne() {
    Statistics stats = getSessions().getStatistics();
    stats.clear();
    stats.setStatisticsEnabled( true );
    Night n = new Night();
    Calendar c = new GregorianCalendar();
    c.set( 2000, 2, 2 );
    Date now = c.getTime();
View Full Code Here


    return new FunctionalTestClassTestSuite( StatsTest.class );
  }

  public void testCollectionFetchVsLoad() throws Exception {
    Statistics stats = getSessions().getStatistics();
    stats.clear();

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

    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

    }

    public void testEmptySecondLevelCacheEntry() throws Exception {
        getSessions().evictEntity(Item.class.getName());
        Statistics stats = getSessions().getStatistics();
        stats.clear();
        SecondLevelCacheStatistics statistics = stats.getSecondLevelCacheStatistics(getPrefixedRegionName(Item.class.getName()));
        Map cacheEntries = statistics.getEntries();
        assertEquals(0, cacheEntries.size());
    }
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

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.