users@glassfish.java.net

Re: Persistence / JPA / TopLink: lost updates

From: <glassfish_at_javadesktop.org>
Date: Fri, 01 Feb 2008 15:36:40 PST

Commiting is the wrong word. The proper word is "flush".

By flushing the enitymanager, is synchronizes with the DB and writes your changes, but it's still part of the overall transaction.

If you later rollback, the changes will rollback normally.

The JPA tends to delay writes to the DB to as late as practical (typically at transaction end). Calling EntityManger.flush() will fix that.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=257086