How will you explain save() and saveorupdate() methods in hibernate?



How will you explain save() and saveorupdate() methods in hibernate?..

Answer / Kuldeep Shakya

In Hibernate, the 'save()' method is used to persist a new object or update an existing one. If the object is new, it gets inserted into the database; if the object already exists in the database, the changes made to the object will be saved. The 'saveorupdate()' method behaves similarly but avoids duplicate entries by only updating the object if its primary key already exists in the database.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

What is orm hibernate?

1 Answers  


In how many ways objects can be identified in Hibernate?

1 Answers  


What is disadvantage of hibernate?

1 Answers  


What is hibernate configuration file?

1 Answers  


After which hibernate version, related entities are initialized lazily?

1 Answers  


What is second level cache in hibernate?

1 Answers  


Can I disable first level cache in hibernate?

1 Answers  


What are different orm tools?

1 Answers  


What is hibernate 2nd level cache?

1 Answers  


What hibernate save returns?

1 Answers  


What is hibernate search?

1 Answers  


What is hibernate connection pool_size?

1 Answers  


Categories