You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by Christian Schneider <ch...@die-schneider.net> on 2015/02/11 17:54:53 UTC
[Discuss] Remove wrapping of XA DataSources in aries jpa
Aries JPA supports two ways of defining data sources in persistence.xml
files.
One is to define a jndi name. Here aries jndi is used to retrieve a
DataSource that is defined as an OSGi service.
In this case we currently check if the DataSource is an XADataSource. If
yes then we wrap it into a DataSource that auto enlists itself as an XA
resource.
The other way is to define the javax.persistence.jdbc.driver property.
In this case we search for a suitable DataSourceFactory. The we use
createXADataSource if jta is supported and wrap it like above.
I think this wrapping should not be part of aries jpa. Instead people
should either already publish a DataSource that does the XA handing
internally or use a DataSourceFactory that does that same.
Both cases are now nicely supported by pax jdbc.
See
https://ops4j1.jira.com/wiki/display/PAXJDBC/Pooling+and+XA+support+for+DataSourceFactory
Another reason to remove the wrapping is that we only cover the
enlisting of the XAResource. Our code explicitly states that we do not
support pooling or error handling in our XADataSource wrapping. So out
approach probably can not be used in production anyway.
So I propose we remove the wrapping code in aries jpa. If someone
supplies an XADataSource via jndi we can simply throw an exception and
explain that we expect an already wrapped DataSource.
For the DataSourceFactory case we can simply always call the
createDataSource method instead of the XA one and again expect that
people supply a DataSourceFactory that does the wrapping.
I would be interested in your feedback about this. Especially if I
overlooked something and we should keep the wrapping.
Christian
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com