What is the difference between merge and update?update () : When the session does not contain the persistent instance with the same identifier, and if it is sure use update for the data persistence in the hibernate.
merge () : Irrespective of the state of a session, if there is a need to save the modifications at any given time, use merge().What is the difference between merge and update?- Update should be used to save the data when the session does not contain an already persistent instance with the same identifier.
- Merge should be used to save the modificatiions at any time without knowing about the state of a session.
|