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.
Save | Persist |
---|---|
Hibernate Proprietary method | Part of the JPA specification |
Returns ID of the saved object | Returns a void |
Insert happens immediately in order to return the ID | May not cause the database insert to happen immediately and the insert might happen later when the session is flushed |
Comments
Post a Comment