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 And I suspect "is the correct way to shut down the hibernate If this is correct If not, please advise me to recommend opening / closing hibernate You can post a little bit of DOIPL code ...... If you use If you use session object for the DB function in my
XYZDaoImpl class.
session every time after any kurt operation object?"
session objects.
sessionFactory.getCurrentSession () , you can get current session..in. This case framework automatically flags and closes when the transaction ends (committed or rollback).
sessionFactory.openSession () , you have to conduct a session and flush it and close it manually.
Comments
Post a Comment