Difference between save() and saveorupdate() method of hibernate?



Difference between save() and saveorupdate() method of hibernate?..

Answer / Prem Varddhan

The 'save' method saves a new instance to the database, while the 'saveorupdate' method saves or updates an existing instance depending on whether it is already in the database. If the instance is already associated with a session (managed), saveorupdate() will update the instance; otherwise, it will create a new one.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

What is @manytoone?

1 Answers  


What is the use of @transient annotation?

1 Answers  


What is hibernate and spring java?

1 Answers  


How to get single record from database using hibernate?

1 Answers  


Why orm is required?

1 Answers  


What is the java persistence api (jpa)?

1 Answers  


What is difference between getcurrentsession () and opensession ()?

1 Answers  


How to add Hibernate mapping file in hibernate configuration file?

1 Answers  


What is the difference between merge and merge join in ssis?

1 Answers  


Define persistent classes.

1 Answers  


What are the core interfaces of hibernate?

1 Answers  


Does hibernate support nosql?

1 Answers  


Categories