Monday, January 4, 2016

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

Ref:- http://career.guru99.com/hibernate-interview-questions/

Sessionsave() 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.
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.

No comments:

Post a Comment