本文整理了Java中org.hibernate.stat.Statistics.setStatisticsEnabled()
方法的一些代码示例,展示了Statistics.setStatisticsEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Statistics.setStatisticsEnabled()
方法的具体详情如下:
包路径:org.hibernate.stat.Statistics
类名称:Statistics
方法名:setStatisticsEnabled
[英]Enable statistics logs (this is a dynamic parameter)
[中]启用统计日志(这是一个动态参数)
代码示例来源:origin: hibernate/hibernate-orm
@Override
public Object invoke(Object... args) {
org.hibernate.stat.Statistics statistics = getStatistics( getEntityManagerFactory( args ) );
if ( statistics != null ) {
if ( args.length > 0 && args[0] instanceof Boolean ) {
Boolean newValue = (Boolean) args[0];
statistics.setStatisticsEnabled( newValue.booleanValue() );
}
return Boolean.valueOf( statistics.isStatisticsEnabled() );
}
return null;
}
};
代码示例来源:origin: wildfly/wildfly
@Override
public Object invoke(Object... args) {
org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
if (statistics != null) {
if (args.length > 0 && args[0] instanceof Boolean) {
Boolean newValue = (Boolean) args[0];
statistics.setStatisticsEnabled(newValue.booleanValue());
}
return Boolean.valueOf(statistics.isStatisticsEnabled());
}
return null;
}
};
代码示例来源:origin: wildfly/wildfly
@Override
public Object invoke(Object... args) {
org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
if (statistics != null) {
if (args.length > 0 && args[0] instanceof Boolean) {
Boolean newValue = (Boolean) args[0];
statistics.setStatisticsEnabled(newValue.booleanValue());
}
return Boolean.valueOf(statistics.isStatisticsEnabled());
}
return null;
}
};
代码示例来源:origin: wildfly/wildfly
@Override
public Object invoke(Object... args) {
org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
if (statistics != null) {
if (args.length > 0 && args[0] instanceof Boolean) {
Boolean newValue = (Boolean) args[0];
statistics.setStatisticsEnabled(newValue.booleanValue());
}
return Boolean.valueOf(statistics.isStatisticsEnabled());
}
return null;
}
};
代码示例来源:origin: wildfly/wildfly
@Override
public Object invoke(Object... args) {
org.hibernate.stat.Statistics statistics = getStatistics(getEntityManagerFactory(args));
if (statistics != null) {
if (args.length > 0 && args[0] instanceof Boolean) {
Boolean newValue = (Boolean) args[0];
statistics.setStatisticsEnabled(newValue.booleanValue());
}
return Boolean.valueOf(statistics.isStatisticsEnabled());
}
return null;
}
};
代码示例来源:origin: hibernate/hibernate-orm
assertEquals( 0, q.list().size() );
Statistics stats = sessionFactory().getStatistics();
stats.setStatisticsEnabled( true );
stats.clear();
q = s.getNamedQuery( "night.duration" );
代码示例来源:origin: hibernate/hibernate-orm
tx = s.beginTransaction();
Statistics stats = sessionFactory().getStatistics();
stats.setStatisticsEnabled( true );
stats.clear();
Query q = s.getNamedQuery( "night&areaCached" );
代码示例来源:origin: hibernate/hibernate-orm
stats.setStatisticsEnabled( true );
stats.clear();
assertEquals(
代码示例来源:origin: hibernate/hibernate-orm
stats.setStatisticsEnabled( true );
stats.clear();
assertEquals( "Cache hits should be empty", 0, stats.getNaturalIdCacheHitCount() );
代码示例来源:origin: hibernate/hibernate-orm
stats.setStatisticsEnabled( true );
stats.clear();
assertEquals( "NaturalId cache puts should be zero", 0, stats.getNaturalIdCachePutCount() );
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* {@inheritDoc}
*
* @see net.sf.ehcache.hibernate.management.api.HibernateStats#setStatisticsEnabled(boolean)
*/
public void setStatisticsEnabled(boolean flag) {
getStatistics().setStatisticsEnabled(flag);
sendNotification(CACHE_STATISTICS_ENABLED, flag);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testNaturalIdLoaderCached() {
Statistics stats = sessionFactory().getStatistics();
stats.setStatisticsEnabled( true );
stats.clear();
stats.setStatisticsEnabled( true );
stats.clear();
stats.setStatisticsEnabled( true );
stats.clear();
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testNaturalIdLoaderNotCached() {
saveSomeCitizens();
Session s = openSession();
Transaction tx = s.beginTransaction();
State france = this.getState( s, "Ile de France" );
final NaturalIdLoadAccess naturalIdLoader = s.byNaturalId( Citizen.class );
naturalIdLoader.using( "ssn", "1234" ).using( "state", france );
//NaturalId cache gets populated during entity loading, need to clear it out
this.cleanupCache();
Statistics stats = sessionFactory().getStatistics();
stats.setStatisticsEnabled( true );
stats.clear();
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
// first query
Citizen citizen = (Citizen)naturalIdLoader.load();
assertNotNull( citizen );
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
// cleanup
tx.rollback();
s.close();
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
/**
* @see StatisticsServiceMBean#setStatisticsEnabled(boolean)
*/
public void setStatisticsEnabled(boolean enable) {
stats.setStatisticsEnabled(enable);
}
代码示例来源:origin: hibernate/hibernate
/**
* @see StatisticsServiceMBean#setStatisticsEnabled(boolean)
*/
public void setStatisticsEnabled(boolean enable) {
stats.setStatisticsEnabled(enable);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* {@inheritDoc}
*
* @see net.sf.ehcache.hibernate.management.api.HibernateStats#setStatisticsEnabled(boolean)
*/
public void setStatisticsEnabled(boolean flag) {
getStatistics().setStatisticsEnabled(flag);
sendNotification(CACHE_STATISTICS_ENABLED, flag);
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* {@inheritDoc}
*
* @see net.sf.ehcache.hibernate.management.api.HibernateStats#setStatisticsEnabled(boolean)
*/
public void setStatisticsEnabled(boolean flag) {
getStatistics().setStatisticsEnabled(flag);
sendNotification(CACHE_STATISTICS_ENABLED, flag);
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* {@inheritDoc}
*
* @see net.sf.ehcache.hibernate.management.api.HibernateStats#setStatisticsEnabled(boolean)
*/
public void setStatisticsEnabled(boolean flag) {
getStatistics().setStatisticsEnabled(flag);
sendNotification(CACHE_STATISTICS_ENABLED, flag);
}
代码示例来源:origin: org.apertereports/dao
private static void configureSessions() {
try {
Configuration annotationConfiguration = new AnnotationConfiguration();
Configuration cfg = annotationConfiguration.configure("hibernate.cfg.xml");
sessionFactory = cfg.buildSessionFactory();
sessionFactory.getStatistics().setStatisticsEnabled(true);
} catch (Exception e) {
logger.error("configure session error", e);
throw new ARRuntimeException(e);
}
}
代码示例来源:origin: org.jbpm/pvm
public void beginCacheTest() {
SessionFactory sessionFactory = environment.get(SessionFactory.class);
if (sessionFactory != null) {
log.debug("=================================================================");
log.debug("Beginning of the cache test, no more sql query should be performed before the end of the test");
log.debug("=================================================================");
sessionFactory.getStatistics().clear();
sessionFactory.getStatistics().setStatisticsEnabled(true);
}
}
内容来源于网络,如有侵权,请联系作者删除!