aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Lee <>
Subject Re: jpa: Type of DataSource expected in persistence.xml
Date Sat, 19 Jul 2014 13:10:58 GMT
Provider is expected both jta-data-source and non-jta-data-source to be of
type implements javax.sql.DataSource interface.

Based on the XADataSource javadoc: "A factory for <code>XAConnection</code>
objects that is used internally...." The interface has only non-public
methods and does not implement the DataSource interface.

It is up to the DataSource implementation to support 1PC or XA transaction
protocol or connection pooling feature (dbcp).

On Sat, Jul 19, 2014 at 1:59 AM, Christian Schneider <> wrote:

> 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
> ops4j.pax.jdbc/tree/master/pax-jdbc-pool .
> It will support to wrap DataSources in pooling and also XA handling.
> Together with
> 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.
> ---
> 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
> Open Source Architect
> Talend Application Integration Division

Albert Lee.

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