What’s the difference between session.save() and session.saveorupdate() methods in hibernate?



What’s the difference between session.save() and session.saveorupdate() methods in hibernate?..

Answer / Rohit Kumar Tyagi

The difference lies in how they handle objects that are already persisted. save() will insert a new object if it's not already saved, while saveorupdate() checks whether an entity is transient or detached before deciding to either insert or update the entity.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

What is column id?

1 Answers  


What is @embeddedid in hibernate?

1 Answers  


What is orm in entity framework?

1 Answers  


What are extension interfaces?

1 Answers  


Which came first jpa or hibernate?

1 Answers  


What is callback interface in hibernate?

1 Answers  


Is hibernate better than jdbc?

1 Answers  


How do you implement one to many relationships in hibernate?

1 Answers  


What is native query in hibernate?

1 Answers  


Why we use hibernate instead of jdbc?

1 Answers  


What is Hibernate Session and how to get it?

1 Answers  


How will you integrate hibernate with spring framework?

1 Answers  


Categories