Package org.hibernate.stat

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


   */
  public String queryCacheCheck(String id){
   
    EntityManager em = emf.createEntityManager();
    Statistics stats = em.unwrap(Session.class).getSessionFactory().getStatistics();
    stats.clear();

    try{
          // the nextTimestamp from infinispan is "return System.currentTimeMillis() / 100;"
          Thread.sleep(1000);
         
View Full Code Here


   */
  public String queryCacheCheckIfEmpty(String id){
   
    EntityManager em = emf.createEntityManager();
    Statistics stats = em.unwrap(Session.class).getSessionFactory().getStatistics();
    stats.clear();

    try{
          // the nextTimestamp from infinispan is "return System.currentTimeMillis() / 100;"
          Thread.sleep(1000);
         
View Full Code Here

      deactivation = new Date();
      info.append("Statistics disabled\n");
    } else if ("clear".equals(action)) {
      activation = null;
      deactivation = null;
      statistics.clear();
      generalStatistics.clear();
      info.append("Statistics cleared\n");
    }
    addActionMessage(info.toString());
    put("active", active);
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

    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

    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

        france));
    criteria.setCacheable(true);

    Statistics stats = getSessions().getStatistics();
    stats.setStatisticsEnabled(true);
    stats.clear();
    assertEquals("Cache hits should be empty", 0, stats
        .getQueryCacheHitCount());

    // first query
    List results = criteria.list();
View Full Code Here

        france));
    criteria.setCacheable(false);

    Statistics stats = getSessions().getStatistics();
    stats.setStatisticsEnabled(true);
    stats.clear();
    assertEquals("Cache hits should be empty", 0, stats
        .getQueryCacheHitCount());

    // first query
    List results = criteria.list();
View Full Code Here

    criteria.add(Restrictions.naturalId().set("citizen", c1));
    criteria.setCacheable(true);

    Statistics stats = getSessions().getStatistics();
    stats.setStatisticsEnabled(true);
    stats.clear();
    assertEquals("Cache hits should be empty", 0, stats
        .getQueryCacheHitCount());

    // first query
    List results = criteria.list();
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

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.