Hi all,

I am using openjpa and aries blueprint(last deployed SNAPSHOT) on latest Karaf SNAPSHOT.
I have a bundle offering a persistence service to my other bundles.

My blueprint configuration is the following:
<bean id="connectorJPA" class="org.openengsb.persistence.connector.jpabackend.ConnectorJPAPersistenceBackendService">
    <tx:transaction method="*" value="Required" />
    <jpa:context property="entityManager" unitname="openengsb-connector" />
  </bean>

<service interface="org.openengsb.core.api.persistence.ConfigPersistenceBackendService">
    <service-properties>
      <entry key="backend.id" value="connector-jpa-persistence" />
    </service-properties>
    <ref component-id="connectorJPA" />
  </service>

part of the persistence.xml
<persistence-unit name="openengsb-connector" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/openengsb)</jta-data-source>

My problem is that I have to put the calls to the entityManager into synchronized(entityManager){} blocks, because the service can get called multiple times at once, leading to synchronisation errors in the entityManager since it is not thread safe.

Is there an equivalent to Spring's SharedEntityManagerImpl or any better solution than synchronise manually?

kind regards,
Lukas Stampf

Reply via email to