Yes OpenJPA will occasionally flush when/if it is deemed necessary. One example that comes to mind is the openjpa.FlushBeforeQueries property[1]... I'm sure there are others, but I can't come up with all of the different ones.
The thing that concerns me is that you have Entities that aren't really Entities... is there a reason why these things that shouldn't be persisted aren't just treated as POJOs? It seems that might be a better way to go so then you won't have to fake OpenJPA out. [1] http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#openjpa.FlushBeforeQueries On Mon, Aug 11, 2014 at 1:55 PM, Christoph Weiss <christoph.we...@de.ibm.com > wrote: > Hi Rick, > > Thanks for your reply! > Well actually we do not have any "unwanted flush calls" but we are scared > that they might happen ; ) > > But let's take about the details: > We try to upgrade an old JEE application (with an custom developed > PersistenceFramework) to JPA. > Because of effort and QA reason we want to maintain the old "business > logic". Here we had objects which are created, modified but never stored > in the database. > However those objects are now becoming JPAEntities and so we implemented > our own UpdateManager. This UpdateManager is taking care that only > "selected" objects are flushed. > (as written in one of the previous posts). > > The complete concept and implementation is working fine as long as we can > control when the flush is executed (--> goal "at the end of our EJB > transaction") > However talking to colleagues I understand that the EntityManager might do > flush operations beside the transactions. Reason could be e.g. to free up > cache or memory. > And that is something we want to avoid. > > Now I am not sure if this are just "rumors" from the colleagues or if > there are cases where the EntityManager might execute a flush w/o any > association / trigger from a transaction. > Can you help on this topic? > > Cheers > Christoph > > > > > > > > > > > From: Rick Curtis <curti...@gmail.com> > To: users <users@openjpa.apache.org> > Date: 11.08.2014 20:38 > Subject: Re: Container Managed EntityManager - is there a chance to > control flush calls ? > > > > Nothing immediately comes to my mind. Perhaps a better explanation of what > you are trying to do will expose some other solution. One question though, > what is currently driving the unwanted flush() calls? > > Thanks, > Rick > > > On Mon, Aug 11, 2014 at 1:24 PM, Christoph Weiss > <christoph.we...@de.ibm.com > > wrote: > > > Dear Community, > > > > We are running OpenJPa with "container managed" EntityManagers (using > > WebSphere Application Server). > > Because of technical reasons we want to explicitly control when the > > EntityManager executes the flush. > > > > First I thought that the parameter "FlushMode" could be a solution, but > > reading the documentation I understood it isn't. > > So is there any other way to really control when the flush is executed? > > > > Any reply is appreciated. Thanks for your help in advance! > > > > Cheers > > Christoph Weiss > > > > > > -- > *Rick Curtis* > > -- *Rick Curtis*