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.
>