I don't know the exact reference, but I did this based on some examples I
had seen. The aries.jpa.eclipselink.adapter bundle comes with classes
(OSGiTSWrapper and OSGiTSServer) and I had seen some examples of linking a
persistence unit to use them via the 'eclipselink.target-server' property.

So, are you saying this doesn't need to be done at all? If not, then how
does EL become aware of the transaction manager?

Is it possible that because I am doing this *and* using eclipselink's own
Partitioning/Replication support that I am indeed getting XA-enlisted
datasources without the aries wrappers?

Thanks again for all your help.

v/r
-matt

-----Original Message-----
From: Christian Schneider [mailto:[email protected]] On Behalf Of
Christian Schneider
Sent: Friday, October 09, 2015 4:00 AM
To: Pitts, Matthew W.
Subject: Re: Bundle set recommendations for JPA+JTA+Eclipselink
Partitioning?

I totally did not get why you need the code below.
When you use Aries JPA then Eclipselink should be working with the 
TransactionManager without any special code from your side.

It should also not be necessary that you use any Aries dependencies in 
your user bundles. The only case where it is needed is when you want to 
use the JpaTemplate with DS.

Christian



On 08.10.2015 22:12, [email protected] wrote:
> I'll see if I can put together a sample app replicating this. As for the
> eclipselink enlistment, if it helps to know, I am making EL 'aware' of the
> OSGI TransactionManager by specifying a 'target-platform' that acquires
the
> service, like in [1]. I think this is pretty standard practice though with
> aries-jpa. I just do it from my own classes so that my actual persistence
> unit bundles don't have to import aries-specific classes.
>
> [1]
> public class OSGiTSWrapper extends JTATransactionController
> {
>
>    @Override
>    protected TransactionManager acquireTransactionManager() throws
Exception
>    {
>      BundleContext ctx =
> FrameworkUtil.getBundle(OSGiTSWrapper.class).getBundleContext();
>
>      if (ctx != null)
>      {
>        ServiceReference ref =
> ctx.getServiceReference(TransactionManager.class.getName());
>
>        if (ref != null)
>        {
>          TransactionManager manager = (TransactionManager)
> ctx.getService(ref);
>          return manager;
>        }
>      }
>
>      return super.acquireTransactionManager();
>    }
>
> }
>

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

Open Source Architect
http://www.talend.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to