users@ejb-spec.java.net

[ejb-spec users] [jsr345-experts] Re: Fwd: [jsr342-experts] EJBs and JTA transactional interceptors

From: Jean-Louis MONTEIRO <jeanouii_at_gmail.com>
Date: Sat, 18 Feb 2012 11:14:15 +0100

>
>
>
> The @DontWrapException or so is equivalent to declaring any exception as
>> an
>> ApplicationException in the ejb-jar.xml, right ?
>>
>
> It's equivalent to declaring them *all* as application exceptions.
>
>
> If yes, do we really need that additional exception?
>>
>
> It's not an exception, it's an annotation.


Yes sorry for the typo.


>
> I guess we don't need it, because if we are throwing external
>> exceptions, we
>> still need to declare them in the ejb-jar.xml file (we can't change a
>> provided
>> library to add a new annotation). If the exception is internal to the
>> module or
>> application, we can still use the @ApplicationException. Am I wrong?
>>
>
> The new annotation would be on the EJB class or method, not on the
> exceptions.
>

Ok I see now.
Was thinking the opposite, that's why I asked if we really need an
additional annotation.

So, why should we not reuse the @ApplicationException (kinda live
brainstorm ;-)).

In my opinion, we just need to add an extra parameter (let say a value
parameter of type Class or so) and also change the target to add METHOD.
If you do that, you can specify per EJB/Method which exception you wanna
wrap or not (i.e. which one is application exception or not).
Something like @ApplicationException(PersistenceException.class) would be
great and very comprehensive.

We could also have something similar that @Queries in JPA to specify more
than one @ApplicationException.

WDYT?

Jean-Louis