users@glassfish.java.net

Re: GFv1b14 Transaction problems

From: <glassfish_at_javadesktop.org>
Date: Thu, 14 Jun 2007 12:05:55 PDT

For the record, I found my problem. I forgot to annotate one my methods with REQUIRES_NEW.

So, I just want to clarify this because this is confusing.

> Two, if I have this in a Session Bean:
>
> @TransactionAttribute(TransactionAttributeType.REQUIRE
> S_NEW).
> public void a() {
> ...
>
> @TransactionAttribute(TransactionAttributeType.REQUIRE
> S_NEW).
> public void b() {
> a();
> ...
> }

So, when a client calls b(), a new transaction is created and when b() calls a(), since it is a local call, the b() transaction is maintained, and the a() does NOT create a new transaction. This is how I thought it worked.

Now, regarding the ServiceContext technique.

Does this run afoul of the "Session Beans aren't rentrant" mantra?

Is there any reason to use the ServiceContext method over just injecting it, or can a Session Bean not inject itself?
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=222237