spring - Should one close Hibernate Session object every time after performing any CRUD operation? -


I am working with an enterprise application that uses Spring 3.x with Hibernate annotated programming. . Working with the hibernate session object for the DB function in my XYZDaoImpl class.

And I suspect "is the correct way to shut down the hibernate session every time after any kurt operation object?"

If this is correct If not, please advise me to recommend opening / closing hibernate session objects.

You can post a little bit of DOIPL code ......

If you use sessionFactory.getCurrentSession () , you can get current session..in. This case framework automatically flags and closes when the transaction ends (committed or rollback).

If you use sessionFactory.openSession () , you have to conduct a session and flush it and close it manually.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -