Hibernate Stupid question? Update Permanent Object

I have a little question. I need to update an object. I will bring it. An object is a permanent object. Now .. If I change any properties because it is a pre-existing (not detached) object, will any monitor lizards be saved right away? Do I need to call a function? Or when the session is cleared, is the modification saved?

Thanks!

+6
java hibernate
source share
2 answers

If it is a persistent object, the changes will be saved when the session is cleared.

+5
source share

Regarding Chris’s answer and the following question “How to set up a session to close after a request”: the traditional way to do this is to wrap the corresponding servlets (assuming that this is a web application) in the Filter that opens the session and associates it with the current thread, calls doFilter. and then either completes the transaction or rolls back the transaction based on whether an error has occurred. This is called the Open Session in View template.

0
source share

All Articles