HHH-7097 - Entity load event doesn't result in naturalId->pk caching
This commit is contained in:
parent
f26435dfec
commit
0732db14b8
|
@ -115,24 +115,23 @@ public class NaturalIdOnSingleManyToOneTest extends BaseCoreFunctionalTestCase {
|
||||||
Statistics stats = sessionFactory().getStatistics();
|
Statistics stats = sessionFactory().getStatistics();
|
||||||
stats.setStatisticsEnabled( true );
|
stats.setStatisticsEnabled( true );
|
||||||
stats.clear();
|
stats.clear();
|
||||||
assertEquals(
|
assertEquals( "NaturalId cache puts should be zero", 0, stats.getNaturalIdCachePutCount() );
|
||||||
"Cache hits should be empty", 0, stats
|
assertEquals( "NaturalId cache hits should be zero", 0, stats.getNaturalIdCacheHitCount() );
|
||||||
.getNaturalIdCacheHitCount()
|
assertEquals( "NaturalId cache misses should be zero", 0, stats.getNaturalIdCacheMissCount() );
|
||||||
);
|
|
||||||
|
|
||||||
// first query
|
// first query
|
||||||
List results = criteria.list();
|
List results = criteria.list();
|
||||||
assertEquals( 1, results.size() );
|
assertEquals( 1, results.size() );
|
||||||
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
||||||
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
||||||
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
|
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
|
||||||
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
||||||
|
|
||||||
// query a second time - result should be in session cache
|
// query a second time - result should be in session cache
|
||||||
criteria.list();
|
criteria.list();
|
||||||
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
||||||
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
||||||
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
|
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
|
||||||
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|
|
@ -101,14 +101,14 @@ public class NaturalIdTest extends BaseCoreFunctionalTestCase {
|
||||||
assertEquals( 1, results.size() );
|
assertEquals( 1, results.size() );
|
||||||
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
||||||
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
||||||
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
|
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
|
||||||
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
||||||
|
|
||||||
// query a second time - result should be cached in session
|
// query a second time - result should be cached in session
|
||||||
criteria.list();
|
criteria.list();
|
||||||
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
||||||
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
||||||
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
|
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
|
||||||
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
@ -141,7 +141,7 @@ public class NaturalIdTest extends BaseCoreFunctionalTestCase {
|
||||||
assertNotNull( citizen );
|
assertNotNull( citizen );
|
||||||
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
assertEquals( "NaturalId Cache Hits", 0, stats.getNaturalIdCacheHitCount() );
|
||||||
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
assertEquals( "NaturalId Cache Misses", 1, stats.getNaturalIdCacheMissCount() );
|
||||||
assertEquals( "NaturalId Cache Puts", 2, stats.getNaturalIdCachePutCount() );
|
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
|
||||||
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
assertEquals( "NaturalId Cache Queries", 1, stats.getNaturalIdQueryExecutionCount() );
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
@ -184,7 +184,7 @@ public class NaturalIdTest extends BaseCoreFunctionalTestCase {
|
||||||
assertNotNull( citizen );
|
assertNotNull( citizen );
|
||||||
assertEquals( "NaturalId Cache Hits", 1, stats.getNaturalIdCacheHitCount() );
|
assertEquals( "NaturalId Cache Hits", 1, stats.getNaturalIdCacheHitCount() );
|
||||||
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
|
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
|
||||||
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
|
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
|
||||||
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
|
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
@ -231,7 +231,7 @@ public class NaturalIdTest extends BaseCoreFunctionalTestCase {
|
||||||
assertNotNull( citizen );
|
assertNotNull( citizen );
|
||||||
assertEquals( "NaturalId Cache Hits", 1, stats.getNaturalIdCacheHitCount() );
|
assertEquals( "NaturalId Cache Hits", 1, stats.getNaturalIdCacheHitCount() );
|
||||||
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
|
assertEquals( "NaturalId Cache Misses", 0, stats.getNaturalIdCacheMissCount() );
|
||||||
assertEquals( "NaturalId Cache Puts", 1, stats.getNaturalIdCachePutCount() );
|
assertEquals( "NaturalId Cache Puts", 0, stats.getNaturalIdCachePutCount() );
|
||||||
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
|
assertEquals( "NaturalId Cache Queries", 0, stats.getNaturalIdQueryExecutionCount() );
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|
Loading…
Reference in New Issue