users@glassfish.java.net

Re: JPA - entityManager.flush()

From: <glassfish_at_javadesktop.org>
Date: Sun, 13 May 2007 14:08:05 PDT

Well,
Just one though,

This method I just described is annotated with @Timeout, It runs every X seconds and invoke a query to seek for 'entities' that were not flagged with that boolean flag,

Afte flush (And also the method ends so I assume the transaction should be comitted alreardy), the next time this method time outs it query the database and finds out that the boolean flag was not flagged at all!


I'm not sure how exactly JPA handles the state of the entities, I assume it has its internal cache mechanisms, but still,

Is there any way to safely commit the transaction/flush the data into the database at some point? so I can be safely sure that the next time I query some entities the query will be executed over the comitted data?


As always, thanks.

Of course, I use EJB3 / injected entityManager...


Thanks.
[Message sent by forum member 'trouby' (trouby)]

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