Difference between save and persist in Hibernate

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.

 

Edit
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

 

 

Comments

Popular posts from this blog

How to use logging in SpringBoot with code samples

Python While Loop with code samples

How to convert a List to a Set