当前位置: 首页>>代码示例>>Java>>正文


Java SessionStatistics类代码示例

本文整理汇总了Java中org.hibernate.stat.SessionStatistics的典型用法代码示例。如果您正苦于以下问题:Java SessionStatistics类的具体用法?Java SessionStatistics怎么用?Java SessionStatistics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SessionStatistics类属于org.hibernate.stat包,在下文中一共展示了SessionStatistics类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: flush

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
/**
 * Flushes the current state to the database.
 */
public void flush() {
  if (SessionHandler.isSessionHandlerPresent()) {
    long s1 = System.currentTimeMillis();
    SessionHandler.getInstance().getSession().flush();
    if (log.isDebugEnabled()) {
      long s2 = System.currentTimeMillis();
      SessionStatistics sessStat = SessionHandler.getInstance().getSession().getStatistics();
      dumpSessionEntities();
      log.debug(
          "Flush of " + sessStat.getEntityCount() + " entities and "
              + sessStat.getCollectionCount() + " collections took: " + (s2 - s1),
          new Throwable());
    }
  }
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:19,代码来源:OBDal.java

示例2: dumpSessionEntities

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
/**
 * Utility method to log all entities loaded into the current hibernate session. Useful to debug
 * slow flush() calls.
 */
private void dumpSessionEntities() {
  SessionStatistics sessStat = SessionHandler.getInstance().getSession().getStatistics();
  log.debug("Dumping all entities in session");
  for (Object o : sessStat.getEntityKeys()) {
    log.debug(o);
  }
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:12,代码来源:OBDal.java

示例3: dalObjectLoaded

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private boolean dalObjectLoaded(String entityName, String id) {
  SessionStatistics stats = SessionHandler.getInstance().getSession().getStatistics();
  for (EntityKey k : (Set<EntityKey>) stats.getEntityKeys()) {
    if (entityName.equals(k.getEntityName()) && id.equals(k.getIdentifier())) {
      return true;
    }
  }
  return false;
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:11,代码来源:ComputedColumnsTest.java

示例4: testSessionStatistics

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
public void testSessionStatistics() throws Exception {
	Session s = openSession();
	Transaction tx = s.beginTransaction();
	Statistics stats = getSessions().getStatistics();
	stats.clear();
	boolean isStats = stats.isStatisticsEnabled();
	stats.setStatisticsEnabled(true);
	Continent europe = fillDb(s);
	tx.commit();
	s.clear();
	tx = s.beginTransaction();
	SessionStatistics sessionStats = s.getStatistics();
	assertEquals( 0, sessionStats.getEntityKeys().size() );
	assertEquals( 0, sessionStats.getEntityCount() );
	assertEquals( 0, sessionStats.getCollectionKeys().size() );
	assertEquals( 0, sessionStats.getCollectionCount() );
	europe = (Continent) s.get( Continent.class, europe.getId() );
	Hibernate.initialize( europe.getCountries() );
	Hibernate.initialize( europe.getCountries().iterator().next() );
	assertEquals( 2, sessionStats.getEntityKeys().size() );
	assertEquals( 2, sessionStats.getEntityCount() );
	assertEquals( 1, sessionStats.getCollectionKeys().size() );
	assertEquals( 1, sessionStats.getCollectionCount() );
	tx.commit();
	s.close();

	stats.setStatisticsEnabled( isStats);

}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:30,代码来源:SessionStatsTest.java

示例5: getStatistics

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
@Override
public SessionStatistics getStatistics() {
	return session.getStatistics();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SessionDelegatorBaseImpl.java

示例6: getStatistics

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
@Override
public SessionStatistics getStatistics() {
	checkTransactionSynchStatus();
	return new SessionStatisticsImpl(this);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:SessionImpl.java

示例7: getStatistics

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
public SessionStatistics getStatistics() {
	checkTransactionSynchStatus();
	return new SessionStatisticsImpl(this);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:5,代码来源:SessionImpl.java

示例8: getStatistics

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
/**
 * Get the statistics for this session.
 *
 * @return The session statistics being collected for this session
 */
public SessionStatistics getStatistics();
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:Session.java

示例9: getStatistics

import org.hibernate.stat.SessionStatistics; //导入依赖的package包/类
/**
 * Get the statistics for this session.
 */
public SessionStatistics getStatistics();
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:5,代码来源:Session.java


注:本文中的org.hibernate.stat.SessionStatistics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。