Hibernate ORM Upgrade Related Queries from 5.2 to 5.6.11

Hello Team,
I am trying to upgrade Hibernate version from 5.2.12 to 5.6.11, While after doing some changes most of the things looks great so far. I have some queries/concerns that i need to clarify just to make sure if the change has been done intentionally.

Earlier when we close all the sessions and then query for getEntityCount() in SessionStatisticsImpl, it used to throw the java.lang.IllegalStateException with Session/EntityManager is closed as the message, the corresponding stack trace is as shown below

java.lang.IllegalStateException: Session/EntityManager is closed
	at org.hibernate.internal.AbstractSharedSessionContract.checkOpen(AbstractSharedSessionContract.java:337)
	at org.hibernate.engine.spi.SharedSessionContractImplementor.checkOpen(SharedSessionContractImplementor.java:135)
	at org.hibernate.internal.AbstractSharedSessionContract.checkOpenOrWaitingForAutoClose(AbstractSharedSessionContract.java:343)
	at org.hibernate.internal.SessionImpl.getPersistenceContext(SessionImpl.java:2275)
	at org.hibernate.stat.internal.SessionStatisticsImpl.getEntityCount(SessionStatisticsImpl.java:27)

Now with the upgraded version of 5.6.11, there is no such exception and it quietly return the count as 0.

Is this change intended as a part of performance improvement by removing un-necessary exceptions?

Thanks in Advance!!

The commit that caused this change in behavior is HHH-13465 Allow inlined access to the PersistenceContext for internal… · hibernate/hibernate-orm@2e81c32 · GitHub

Since SessionStatistics doesn’t say anything explicit about what should happen when the session is closed, this is IMO a valid change, but if you want to discuss this further, I would suggest you ask Sanne Grinovero in our Zulip chat directly.