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 |
What is orm hibernate?
In how many ways objects can be identified in Hibernate?
What is disadvantage of hibernate?
What is hibernate configuration file?
After which hibernate version, related entities are initialized lazily?
What is second level cache in hibernate?
Can I disable first level cache in hibernate?
What are different orm tools?
What is hibernate 2nd level cache?
What hibernate save returns?
What is hibernate search?
What is hibernate connection pool_size?