Hi!
Just a small question on EJBs and transactions. I assume that there are no
implicit transactions started when calling a business method on an EJB that
does not have the @TransactionAttribute annotation? (Assume of course that
there are no other ongoing transaction)
Regards
LF
--
Med vänlig
Hi,
As per the spec, the default is REQUIRED.
So if nothing specified on the class and on the method, the container is
going to start a new transaction before executing the method.
If you do not want this behavior, use SUPPORTS (if one already started use
it, otherwise, do nothing) or NOT_SUPPORT
Sorry, NOT_SUPPORTED does not throw an exception, but suspend the current
if any.
All detailed here
http://docs.oracle.com/javaee/6/api/javax/ejb/TransactionAttributeType.html
JLouis
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com
On Mon, Sep 8, 2014 at 3:25 PM,
Hi Jean-Louis
So an EJB (e.g. a stateless EJB) NOT annotated with @TransactionAttribute
at all will still have the container start a transaction when its methods
are called?
My understanding was that REQUIRED was the default if annotated, I might
have got it all wrong though
Regards
LF
On Mon,
Sorry... saw the following in the JavaDoc for @TransactionAttribute
"If the TransactionAttribute annotation is not specified, and the bean uses
container managed transaction demarcation, the semantics of the
REQUIRED transaction
attribute are assumed."
That answers my follow up question...
On
Right, the idea is to get 80% of the use cases supported by default and
running without anything.
So yes, if nothing at all, then REQUIRED is assumed.
Not all wrong indeed ;-)
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com
On Mon, Sep 8, 2014 at 3:32 PM, Lars-F
he he
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com
On Mon, Sep 8, 2014 at 3:35 PM, Lars-Fredrik Smedberg
wrote:
> Sorry... saw the following in the JavaDoc for @TransactionAttribute
>
> "If the TransactionAttribute annotation is not specified, and the bean u