save
Save
method stores an object into the database. It will Persist the given transient instance, first assigning a generated identifier. It returns the id of the entity created.
Whereas,
SaveOrUpdate()
Calls either
save() or update() on the basis of identifier exists or not. e.g if identifier exists, save()will be called or else update() will be called.
There are many more like persist(), merge(), saveOrUpdateCopy(). Almost all are same giving slight different functionality and usability.
For more, you can read this. What are the differences between the different saving methods in Hibernate?
No comments:
Post a Comment