Google News
logo
Java Hibernates - Interview Questions
What's the difference between session.save() and session.saveOrUpdate() methods in hibernate?
Session.save() method saves a record only if it’s unique with respect to its primary key and will fail to insert if primary key already exists in the table.

Session.saveOrUpdate() method inserts a new record if primary key is unique and will update an existing record if primary key exists in the table already.
Advertisement