Hibernate articles | Persisting methods
All those confusing persistence methods
When you want to write your object to the database, the Hibernate Session has a confusing abundance of methods to choose from.* save()
* persist()
* update()
* saveOrUpdate()
* merge()In this article, I try to make sense of them.
Perhaps the most common misconception about these methods, is that save() always generates an SQL INSERT statement in the database, and update() always generates an SQL UPDATE in the database.
This is not, true; but, unfortunately, the documentation provided by the Hibernate does nothing to clarify it.