We're updating the issue view to help you get more done. 

Session close counter statistic not updated when using Hibernate in JPA mode

Description

When using hibernate in JPA mode with statistics enabled, the session close statistic is not updated.
Giving a look in the close() method of SessionImpl

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 if ( getSessionFactory().getSessionFactoryOptions().isJpaBootstrap() ) { // Original hibernate-entitymanager EM#close behavior checkSessionFactoryOpen(); checkOpenOrWaitingForAutoClose(); if ( discardOnClose || !isTransactionInProgress( false ) ) { super.close(); } else { //Otherwise, session auto-close will be enabled by shouldAutoCloseSession(). waitingForAutoClose = true; closed = true; } } else { super.close(); if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().closeSession(); } }

we can see that getFactory().getStatistics().closeSession(); is only called in native mode

Environment

Hibernate 5.2.x used in JPA mode, Oracle 11g

Status

Assignee

Andrea Boriero

Reporter

Florent Fourcade

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.1.5

Components

Affects versions

5.2.7

Priority

Trivial