(Turn from: Baidu know) See how to get session. Method 1: After configuring the listener, use getcurrentsession in the DAO (internal principle ...). ), there is no need to manage the closing of the session; Method 2: get through getsession in DAO, must close session after use. The consequence of not shutting down the session is that as the system runs, the number of database connections will gradually increase, eventually causing the database to reject the connection. After the database rejects the connection, restart the app, and the original connection is released, and the app is up and running. If you find that the app has a connection not releasing the problem and 1:30 is not correctly positioned, you can restart the app by timing triggered scheduled tasks to ensure that the app is available to some extent. If the database is DB2, you may also need to restart the server on which the database resides (the operating system).
Hibernate does not close session consequences