openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <>
Subject Re: Calling a getter of an entity will access the broker
Date Thu, 22 Jul 2010 20:44:34 GMT
First off, you're using subclassing enhancement which isn't recommended...
Please checkout these links[1][2] for more info.

On to your real question...

> Our application is a Swing application that displays data fetched directly
from the database.
Is this application just going to display the data, or will it also update
the data?



On Thu, Jul 22, 2010 at 10:37 AM, Pandel <> wrote:

> Our application is a Swing application that displays data fetched directly
> from the database. There is a single entity manager and an extended
> persistence context. Because we want the GUI to be responsive, all the
> transactional database operations are executed into a single separate
> worker
> thread. We don't use the openjpa.Multithreaded = true option because it
> introduces overhead and also because it is susceptible to a deadlock (issue
> OPENJPA-1716).
> Calling a getter on one entity inside the Event Dispatch Thread, while
> other
> operations are executed onto the entity manager in the separate worker
> thread, will automatically access the BrokerImpl concurrently from the EDT
> too. Here is a snippet of a stacktrace confirming this:
> Exception in thread "AWT-EventQueue-0" <openjpa-1.2.1-r752877:753278 fatal
> internal error> org.apache.openjpa.util.InternalException: Multiple
> concurrent threads attempted to access a single broker. By default brokers
> are not thread safe; if you require and/or intend a broker to be accessed
> by
> more than one thread, set the openjpa.Multithreaded property to true to
> override the default behavior.
> at org.apache.openjpa.kernel.BrokerImpl.endOperation(
> at org.apache.openjpa.kernel.BrokerImpl.isActive(
> at
> org.apache.openjpa.kernel.StateManagerImpl.beforeRead(
> at
> org.apache.openjpa.kernel.StateManagerImpl.accessingField(
> at
> org.apache.openjpa.enhance.RedefinitionHelper.accessingField(
> at org.apache.openjpa.enhance.Tabelle$Pratica$pcsubclass.getClienti(Unknown
> Source)
> at Modelli.ClienteView.<init>(
> at Modelli.ClienteController.<init>(
> at Modelli.PraticaController.createPraticaView(
> My question would be: is there proper way to prevent this from happening?
> How can I keep executing the time-consuming transactional operations into a
> worker thread, and still be able to call a getter onto another entity, in a
> thread different than the worker thread, without causing this exception?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message