On Wed, Jul 1, 2009 at 8:59 AM, Daryl Stultz <[email protected]> wrote:

> Hello,
>

To be a little more clear, entity.save() looks like this:

EntityManager em = getEntityManager();
boolean alreadyInTransaction = em.getTransaction().isActive();
if (! alreadyInTransaction) em.getTransaction().begin();
if (getId() == null) em.persist(this);
else em.merge(this);
if (! alreadyInTransaction) em.getTransaction().commit();

The manual states:

The merge method returns a managed copy of the given detached entity. *Changes
> made to the persistent state of the detached entity are applied to this
> managed instance. *


I am assuming that the changes should be flushed to the database upon
commit. I think my unit test shows that this is not happening. That seems
highly unlikely, so if someone could prove me wrong, that would be great.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:[email protected]

Reply via email to