In a persistence.xml I can supply a data source using jndi in two ways:
jta-data-source and non-jta-data-source

From the spec I am not sure what is expected here in the case of a jta-data-source.
For a non-jta-data source the type expected is for sure DataSource.

What does the spec expect in case of jta-data-source. An XADataSource or a DataSource that internally uses an XADataSource to manage XA resources.

In case of JMS I read that the user always has to use ConnectionFactory and is expected to never directly use an XAConnectionFactory. So for example for ActiveMQ there is JCAPoolingConnectionFactory that offers a ConnectionFactory to the outside and is configured with a XAConnectionFactory internally.

Is this the same for jpa? Are there examples how to use this. I have found that dbcp can be used to create such DataSources that handle XA internally. Is dbcp the way to go or can I simply use data sources from providers that already do the same?

I am currently working on pax-jdbc-pool https://github.com/ops4j/org.ops4j.pax.jdbc/tree/master/pax-jdbc-pool .
It will support to wrap DataSources in pooling and also XA handling.

Together with https://github.com/ops4j/org.ops4j.pax.jdbc/tree/master/pax-jdbc-config this will allow to define DataSource services by simply createing a config admin configuration. So it is important that I create the DataSource in the correct ways to be useable by aries jpa.

Best regards

Christian

For reference I attached the part of the jpa sprc about data source defs in persistence.xml.
---

8.2.1.5 jta-data-source, non-jta-data-source
In Java EE environments, the jta-data-source and non-jta-data-source elements are used to specify the global JNDI name of the JTA and/or non-JTA data source to be used by the persistence provider. If neither is specified, the deployer must specify a JTA data source at deployment or a JTA data source must be provided by the container, and a JTA EntityManagerFactory will be created to
correspond to it.
These elements name the data source in the local environment; the format of these names and the ability
to specify the names are product specific.
In Java SE environments, these elements may be used or the data source information may be specified
by other means—depending upon the requirements of the provider.

--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com

Reply via email to