Hibernate does not close session consequences

Source: Internet
Author: User
(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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.