Actually in retrospect - entity and collection stats do not have a problem in this regard. Here are their defs as of current master:
- https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/stat/CollectionStatistics.java
- https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/stat/EntityStatistics.java
However, natural-id stats do: https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/stat/NaturalIdCacheStatistics.java As you can see, NaturalIdCacheStatistics exposes status pertaining to the L2 caching of the natural-id -> id resolutions. IMO we should consider making these consistent : either drop #getHitCount, #getMissCount and #getPutCount from NaturalIdCacheStatistics or add them to CollectionStatistics and EntityStatistics. Similar for QueryStatistics[1]. QueryStatistics is slightly different in that a region storing query results can only store query results - not other kinds of data (compared to "data" regions that can store any mix of entity, collection and natural-id data). Still IMO it is best to have a consistent separation/unification of how we expose L2 cache hit/miss/put counts [1] https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/stat/QueryStatistics.java |