adamparker / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 0 forks source link

Add merge method #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Consider adding merge method to DAOs. Refactor RemoteDAO to use merge/fetch
instead of update.

Why: Update can cause issues if there is already an instance of the entity
attached to the session.
  Actually I had trouble overriding update in the service layer because of
this conflict. It definitely makes sense for the RemoteDAO to use merge.
However, we still have to implement update in case it is used elsewhere,
especially if we have createOrUpdate.

Why Not: With RemoteDAO there will never be another instance of the entity
in the session. (is this true?) It means more methods that have to be
overridden if the update/merge needs to be overridden.

Keep thinking...

Original issue reported on code.google.com by dwolvert on 26 Aug 2008 at 3:42

GoogleCodeExporter commented 9 years ago
Each project may now implement its own general and generic dao or use one of 
several 
included implementations. These can extend the baseDAOImpl that has helper 
implementations for a large number of possible methods, making the 
individualized 
project DAOs trivial in implementation.

Original comment by dwolvert on 16 Dec 2008 at 7:40