I use a JPAEntityManagerProviderFactory (providerFactory) which I inject as a service reference into my repository class.
Furthermore, I inject a EntityManagerFactory (emf) into the repository class as well as the TransactionControl (txControl).
The provider Factory is created by pax-jdbc (I use hibernate).
This provider factory is then used to get the Entity manager like this:
EntityManager em = providerFactory.getProviderFor(emf, null).getResource(txControl);
It fails giving an exception telling that transaction cannot be joined, because it's not open.
The wrapping call is like this:
() -> repo.store(article));
Do you have a code example of how you’re obtaining and using the EntityManager? There should be no usage of the OSGiJtaPlatform from the tx-control XA JPA resource provider, which means that there’s either a bug in the resource provider, or something is misconfigured. If you are a member of the Aries user mailing list then that would be a better place to continue this discussion.
Fwiw, you should ask on the Aries mailing list, where tx-control is developed.
I've recently worked on a new project called pax-transx which provides an abstraction layer on top of transaction managers so that some features can be accessed in a common way. I think this should be used in tx-control instead of wrapping the tm again and not being flexible.
Right now, tx-control uses its own instance of transaction manager and there's no way around afaik, so you can't use the karaf transaction feature if you want to use it.
Anyway, I'd gladly support you if you go to the aries mailing list to raise this point !