All those confusing persistence methods

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.

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

What is 11 + 11 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)