aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <>
Subject [Discuss] Remove wrapping of XA DataSources in aries jpa
Date Wed, 11 Feb 2015 16:54:53 GMT
Aries JPA supports two ways of defining data sources in persistence.xml 
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 
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.

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 Schneider

Open Source Architect

View raw message