What is the difference between and merge and update in hibernate?

difference between and merge and update in hibernate


Use update() if you are sure that the session does not contain an already persistent instance with the same identifier, and merge() if you want to merge your modifications at any time without consideration of the state of the session. In other words, update() is usually the first method you would call in a fresh session, ensuring that reattachment of your detached instances is the first operation that is executed.


This term is basically used in svn (storage repository)

Merge: Merging new code with existing one

Update: After Merging or starting new task its very imp. to take updated file of working copy


suppose you have detached object (means after closing session persistence object becomes detached object) and you have done some changes in this object with help of setter method now you created new ...


asked Jul 1, 2015 in hibernate by rajesh
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.