| Some of these assertions are not correct. Versions before 5.3 do not return null... they return a new, not-real reference. E.g., this test will fail:
final SecondLevelCacheStatistics stats = sessionFactory().getStatistics().getSecondLevelCacheStatistics( "does.not.exist" );
assert stats == null;
The problem is that while all other parts of Hibernate before 5.3 treat the 2 types of caches (domain data and query results) very differently statistics does not. When getSecondLevelCacheStatistics is called null is actually never returned. Generally I'd say this is very bad design and just change the behavior. But as this method is already deprecated I'll just make the behavior consistent with 5.2
In master, getDomainDataRegionStatistics throws IllegalArgumentException if the region can't be resolved or the region is a QueryResultsRegion.
Correct. This is by design. It is the correct forms of the "bad design" mentioned above. It is also a new method added on 5.3 so behavior compatibility is not relevant. |