Sunday, August 21, 2016

JPA: Object Lifecycle States

CREATING & SAVING A NEW OBJECT is changing state from Transient to Persistent by means of the Session object's save() method.





Fetching an instance from the database automatically gives us a persistent object and changes to it are constantly tracked.




Then there's another method of Session object called delete() which removes an instance from the database and returns a transient object!!

No comments:

Post a Comment