Hi Balázs,
I was using pax-jdbc-config with pax-jdbc-pool-dbcp2 to create the
DataSource.
Seems I had a bug in pax-jdbc-pool-dbcp2. I did not use the correct
classes to create the DataSource in a XA aware manner.
I now used a small extra bundle to create the DataSource.
https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-cdi/datasource
With this DataSource the access from the second thread to the DB table
seems to be blocked until the commit is done. So I consider that as a
good sign that it is working correctly now.
I will use this as an example to fix pax-jdbc-pool-dbcp2.
Many thanks for leading me on the right track that the dbcp2 setup may
be the problem.
Christian
On 26.11.2014 16:13, Balázs Zsoldos wrote:
Hi,
Be sure that you use /org.apache.derby.jdbc.EmbeddedXADataSource/ and
the XAResource is enlisted in the current transaction each time a
connection is requested.
A good choice can be if you:
* Instantiate EmbeddedXADataSource. This implements XADataSource
* Wrap it with commons-dbcp BasicManagedDataSource. This implements
DataSource and enlists the XAResource each time a connection is
requested.
* Register BasicManagedDataSource as an OSGi service
* Use the registered OSGi service in persistence.xml
If you use commons-dbcp, be sure that you use at least version 2.0.1.
If you need configurable DS components, you can use:
* https://github.com/everit-org/osgi-jdbc-dsf (Contains components
that can pick up a DataSourceFactory OSGi service and register
either XADataSource or DataSource)
* https://github.com/everit-org/commons-dbcp-component (Contains a
configurable component that instantiates BasicManagedDataSource
and registers it as an OSGi service based on DataSource interface)
Regards,
*Balázs **Zsoldos*
On Wed, Nov 26, 2014 at 3:58 PM, Christian Schneider
<[email protected] <mailto:[email protected]>> wrote:
I just opened
https://issues.apache.org/jira/browse/ARIES-1278
I persist a JPA entity inside a transaction and it is already
visible before the commit. Does anyone have an idea how this can
happen?
Christian
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com