Java Interview QuestionsJPA_and_Hibernate

Difference between save and persist in Hibernate

Posted On
Posted By admin

In this blog post, I will be explaining the difference between the save and persist methods Hibernate. Both thesave and persist methods insert a record into a database table. However, there are some differences between the two.

 

SavePersist
Hibernate Proprietary methodPart of the JPA specification
Returns ID of the saved objectReturns a void
Insert happens immediately in order to return the IDMay not cause the database insert to happen immediately and the insert might happen later when the session is flushed

 

 

If you'd like to watch a detailed video tutorial of this topic or other related topics, do check out my Hibernate course Hibernate from scratch

If you like this post, please do let me know via the comments box below.  You can also connect with me via my Facebook Page or subscribe to my Youtube channel!

Related Post

leave a Comment