What is difference between save and persist method in hibernate?



What is difference between save and persist method in hibernate?..

Answer / Vivek Kumar

The 'save' method in Hibernate is deprecated since Hibernate 4.0. It performs both insert and update operations based on the current state of the entity instance. On the other hand, the 'persist' method only adds an entity to the persistence context without performing any database operation, leaving the actual insert operation for later when transaction commits.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

How transaction management works in Hibernate?

1 Answers  


What is flush in hibernate?

1 Answers  


Why do you use hibernate?

1 Answers  


What is the use of session in hibernate?

1 Answers  


Why is hibernate preferred over jdbc?

1 Answers  


How to make a immutable class in hibernate?

1 Answers  


What is the need for hibernating tools when orm tools can be used?

1 Answers  


What are the two types of collections in hibernate?

1 Answers  


What is hql in hadoop?

1 Answers  


What do you mean by named – sql query?

1 Answers  


Does hibernate work without primary key?

1 Answers  


Why session is not thread safe in hibernate?

1 Answers  


Categories