adspace


What is difference between merge and saveorupdate in hibernate?

Answer Posted / Ankit Verma

In Hibernate, both merge() and saveOrUpdate() are used to persist or update an object. However, there is a subtle difference between them:n- merge(): Merges the state of the given transient instance with the persistent instance in the database if it exists. If the instance is not persistent, a new persistent instance will be created.n- saveOrUpdate(): Saves the transient instance or updates the persistent instance if it already exists in the database.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is latest hibernate version?

493