ArchiveOrangemail archive

users.openjpa.apache.org


(List home) (Recent threads) (2 other Apache OpenJPA lists)

Subscription Options

  • RSS or Atom: Read-only subscription using a browser or aggregator. This is the recommended way if you don't need to send messages to the list. You can learn more about feed syndication and clients here.
  • Conventional: All messages are delivered to your mail address, and you can reply. To subscribe, send an email to the list's subscribe address with "subscribe" in the subject line, or visit the list's homepage here.
  • Low traffic list: less than 3 messages per day
  • This list contains about 10,776 messages, beginning Jun 2007
  • 7 messages added yesterday
Report the Spam
This button sends a spam report to the moderator. Please use it sparingly. For other removal requests, read this.
Are you sure? yes no

Executing queries during transaction

Ad
mwalter 1344011319Fri, 03 Aug 2012 16:28:39 +0000 (UTC)
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!
Home | About | Privacy