users@glassfish.java.net

Re: Client transaction aborted?

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Tue, 27 Aug 2013 13:13:35 -0700

On 8/27/13 11:47 AM, Laird Nelson wrote:
> On Tue, Aug 27, 2013 at 2:16 PM, Marina Vatkina
> <marina.vatkina_at_oracle.com <mailto:marina.vatkina_at_oracle.com>> wrote:
>
> The EJB spec should a) describe the behavior of business method
> invocations in a transaction marked for rollback
>
>
> Yes, please.

File a JIRA ;)
>
> [...] and b) allow to check rollback status in a SUPPORTS method
> if there is a transaction in progress.
>
>
> Oh, this is not possible?

E.g.

8.6.3.9 Handling of getRollbackOnly Method

The container must handle the EJBContext.getRollbackOnly method invoked
from a business method executing with the REQUIRED, REQUIRES_NEW, or
MANDATORY transaction attribute.

The container must throw the java.lang.IllegalStateException if the
EJBContext.getRollbackOnly method is invoked from a business method
executing with the SUPPORTS, NOT_SUPPORTED, or NEVER transaction attribute.

>
> I don't disagree with you, but how would (b) help? Are you suggesting
> allowing business methods that require or support a transaction to be
> entered, even though they can't really do anything?

It just seems too restrictive (in other places the spec says "Invoking
the getRollbackOnly and setRollbackOnly methods is disallowed in the
session bean methods for which the container does not have a meaningful
transaction context").

Best,
-marina

>
> (I'd actually like to see EntityManager#contains(Object) relaxed to
> simply return false if the object it is passed is not even known to
> it. But I'm sure that has all sorts of other implications.)
>
> Best,
> Laird
>
> --
> http://about.me/lairdnelson