當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。