Well javax.transaction.TransactionManager is portable, the jndi name is not
but should be easily configurable (or you can even try the 5-6 well known
ones). You can check org.apache.openjpa.ee.AutomaticManagedRuntime for this
logic more or less


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-07 14:46 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>:

> @Romain
>
> I thought injecting the TransactionManager created non-portable code?
>
> Is there another way to actually suspend the ongoing transaction if
> any....?
>
> Regards
> LF
>
> On Thu, May 7, 2015 at 2:15 PM, Romain Manni-Bucau <[email protected]>
> wrote:
>
> > Injecting the tx manager looks reasonable but ends up to more or less the
> > same yes.
> >  Le 7 mai 2015 13:27, "Lars-Fredrik Smedberg" <[email protected]> a
> > écrit :
> >
> > > Hi
> > >
> > > What we need to do is to make sure that a specific code snippet not
> runs
> > in
> > > a JTA tx....
> > >
> > > We want to do this in a portable way so what we do is the following
> > (psuedo
> > > code)
> > >
> > > @Resource
> > > TransactionSynchronizationRegistry tsr;
> > >
> > > ....
> > >
> > > if (tsr.getTransactionStatus() == Status.STATUS_NO_TRANSACTION) {
> > >     ....run code as is...
> > > }
> > > else {
> > >    ... run code by passing it through an EJB with
> > > @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) which in
> > turn
> > > runs the actual code
> > > }
> > >
> > > Is the above the simplest portable way of doing this in an JEE 6
> > container?
> > >
> > > Any inputs would be great!
> > >
> > > Regards
> > > LF
> > >
> > >
> > > --
> > > Med vänlig hälsning / Best regards
> > >
> > > Lars-Fredrik Smedberg
> > >
> > > STATEMENT OF CONFIDENTIALITY:
> > > The information contained in this electronic message and any
> > > attachments to this message are intended for the exclusive use of the
> > > address(es) and may contain confidential or privileged information. If
> > > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > > immediately at [email protected], and destroy all copies of this
> > > message and any attachments.
> > >
> >
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at [email protected], and destroy all copies of this
> message and any attachments.
>

Reply via email to