Hi Timothy,

thanks for your answer, this makes sense. I still have another question
though:

If I inject the EntityManager via Blueprint into my OSGi-service and I have
multiple clients of this service calling it, don't I have to re-create a
new EntityManager for each request?

I have tried to inject the EntityManagerFactory as well (which works) but
creating a new EntityManager with this instance will only return a non-JTA
aware EntityManager?
I event called joinTransaction() but as soon as I commit the transaction
the underlying dataSource (XA) complains, that the commit might only happen
from the managed transaction...

If using the EntityManager which is being injected everything works, but as
said I don't think I can use it in different requests.

Do you happen to know where my mistake is?

Cheers
Philipp


2013/7/19 Timothy Ward <[email protected]>

> Hi Philipp,
>
> Declarative Services is designed to be an ultra-lightweight injection
> runtime, and so it doesn't include the proxying/interception capabilities
> necessary to support Declarative Qualities of Service like transactions.
> This is one of the primary drivers for choosing blueprint over DS.
>
> There are annotations for managing transactions in Aries blueprint. These
> are contained in the latest (1.0.1) release of
> org.apache.aries.transaction.blueprint.
>
> You can enable annotation support with the following:
>
> <blueprint  xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>             xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0";>
>
>     <tx:enable-annotations/>
>       
>       <bean id="top" class="org.apache.aries.transaction.pojo.AnnotatedPojo"/>
> </blueprint>
>
>
> I hope this helps!
>
> Tim Ward
> -------------------
> Apache Aries PMC member & Enterprise OSGi advocate
> Enterprise OSGi in Action (http://www.manning.com/cummins)
> -------------------
>
>
> ------------------------------
> Date: Thu, 18 Jul 2013 23:00:37 +0200
> Subject: Aries JTA, JPA, and SCR
> From: [email protected]
> To: [email protected]
>
>
> Hi,
>
> I have a question related to JTA (in JPA) context and SCR:
>
> Is it possible to use the container managed transactions also with SCR/DS?
> Or is this only possible via Blueprint?
>
> Furthermore is there any Annotation support for the managing transactions
> or must this be done via the Blueprint XML?
>
> Cheers
> Philipp
>

Reply via email to