Hi,

imagine having a tree of entities and some of them having changed data. In
order to save the entities to the database they have to be validated first.
During validation it is necessary to fetch some additional validation data
from the database. Now if OpenJPA comes to fire the first select it tries to
persist the changed data per default (FlushBeforeQueries=true) and an
exception is raised because in our case some important entity fields are set
shortly before commit using a callback listener (@PrePersist and
@PreUpdate). If these fields aren't set the database throws an error.

Why is FlushBeforeQueries=true the default and what is best practice to cope
with that situation? The flush should execute if the business method which
started the transaction ends. In my opinion our process (changing data,
fetching data to perform validation, persisting) is not really an
exceptional case. Which combination of FlushBeforeQueries and IgnoreChanges
can we use to execute queries during transaction?

Thanks for your help!



--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Executing-queries-during-transaction-tp7580793.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to