Symptom of that: calling Update after changing an object, wondering why changes are persisted even if Update had not been called, wondering how to avoid changes to be persisted. change tracking in insert and update triggers) Create one class per table. Using join fetch in combination with Set Max Result.
Some people don't understand OOD, others don't understand relational design. My latest answers related to that topic: Writing self changing entities.
(It also means that it works quite well with trivial entities.) Ayende also calls it the Stripper Pattern and explains the encapsulation issue.
Not understanding persistence ignorance and writing NH applications as when using explicit SQL.
We optimize and reduce the amount of code that is necessary to store objects and discuss the most efficient processing options.
This is unlike the the way one can simply invoke Entity Manager.persist on an object (even multiple times as mentioned above!
) to save it and continue to use the original object.
The closest alternative seems to be the Entity Manager.merge method, but there is a big difference that has important implications.
The Or Update method, and its cousin Session.update, attach the passed entity to the persistence context while Entity Manager.merge method copies the state of the passed object to the persistent entity with the same identifier and then return a reference to that persistent entity.