What is the difference between hibernate save () saveOrUpdate () and persist () methods?
S.no | Hibernate Save() | SaveorUpdate method() |
---|---|---|
1. | Work to generate a new identifier and then inserting the record into the database | It either can UPDATE or INSERT because as per the existence of record.save() method can be failed with the persistence of the primary key |
2. | Used for bringing a transient object to a persisting state | It can bring both new and existing, i.e., transient and detached into a persistent state or can be said that this method can be used for re-attaching a detached object into Session |
BY Best Interview Question ON 05 Apr 2019