org.hibernate.stat.Statistics.getNaturalIdQueryExecutionCount()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.hibernate.stat.Statistics.getNaturalIdQueryExecutionCount()方法的一些代码示例,展示了Statistics.getNaturalIdQueryExecutionCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Statistics.getNaturalIdQueryExecutionCount()方法的具体详情如下:
包路径:org.hibernate.stat.Statistics
类名称:Statistics
方法名:getNaturalIdQueryExecutionCount

Statistics.getNaturalIdQueryExecutionCount介绍

[英]Get the global number of natural id queries executed against the database
[中]获取对数据库执行的自然id查询的全局数量

代码示例

代码示例来源:origin: prometheus/client_java

@Override
 public double getValue(Statistics statistics) {
  return statistics.getNaturalIdQueryExecutionCount();
 }
}

代码示例来源:origin: hibernate/hibernate-orm

assertEquals(
    "Query execution count should be one", 1, stats
        .getNaturalIdQueryExecutionCount()
);
assertEquals(
    "Query execution count should be one", 1, stats
        .getNaturalIdQueryExecutionCount()
);

代码示例来源:origin: hibernate/hibernate-orm

assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );

代码示例来源:origin: hibernate/hibernate-orm

assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() ); // one for Citizen, one for NaturalIdOnManyToOne
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );

代码示例来源: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: hibernate/hibernate-orm

assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

@Override
public long getNaturalIdQueryExecutionCount() {
  return stats.getNaturalIdQueryExecutionCount();
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

@Override
public long getNaturalIdQueryExecutionCount() {
  return stats.getNaturalIdQueryExecutionCount();
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
  assertEquals("NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount());
  assertEquals("NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount());
  assertEquals("NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount());
  assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
  assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
  assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
  assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
  assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
  assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );

相关文章

Statistics类方法