Sunday, August 21, 2016

HIBERNATE: PERSISTING A DETACHED OBJECT

A retrieved persistent object becomes detached once the session is closed. This however can be fixed by reopening the session and reattaching the object to the session with the help of update() method.

Note: This transforms the object back to persistent state.


Make sure hbm2ddl inside hibernate.cfg.xml is set to update and not create!!

No comments:

Post a Comment