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!!