This discussion is archived
3 Replies Latest reply: Oct 25, 2012 7:57 AM by 970685 RSS

Concurrent access issue with JPA  for a Select query?

java4ever Newbie
Currently Being Moderated
Hi All,

I have been trying to understand why this code,
public <T> List<T> findManyNativeSql(String queryString, Class<T> resultClass)
     {
            Query aQuery = getEntityManager().createNativeQuery(queryString,resultClass); // Throwing the following exception
is causing this exception.
<openjpa-1.1.0-r422266:657916 fatal general error> org.apache.openjpa.persistence.PersistenceException: Multiple concurrent th
reads 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(BrokerImpl.java:1789)
        at org.apache.openjpa.kernel.BrokerImpl.isActive(BrokerImpl.java:1737)
        at org.apache.openjpa.kernel.DelegatingBroker.isActive(DelegatingBroker.java:428)
        at org.apache.openjpa.persistence.EntityManagerImpl.isActive(EntityManagerImpl.java:606)
        at org.apache.openjpa.persistence.PersistenceExceptions$2.translate(PersistenceExceptions.java:66)
        at org.apache.openjpa.kernel.DelegatingBroker.translate(DelegatingBroker.java:102)
        at org.apache.openjpa.kernel.DelegatingBroker.newQuery(DelegatingBroker.java:1227)
I have tried looking at the query which gets printed in the logs when the exception is thrown
[[ACTIVE] ExecuteThread: '32' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR jpa
- ID: 133  queryString= select * from Details where cust_name='SETH'
Any suggestions on the following would be very helpful
Also, AppServer: WL10.3 is being used.


--
VR

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points