Re: Stateful EJB and Local transactions...

Chuck Herrick <[email protected]> Thu, 28 Nov 2002 08:25:48 -0600
Newsgroups gmane.comp.java.sun.connector
Organization CyberDigm Systems
Message-ID <[email protected]>
1.what state are you saving in the EJB?
2. what state is "disappearing?"

Honestly, I'd suggest that you seriously (and I mean VERY SERIOUSLY)
reconsider using stateful. Instead, use Stateless. Even one of the head
techno-dudes at Weblogic has written an article claiming basically that
Stateful EJBs are evil. You can find his article online and read
corroboration elsewhere.

If you're using stateful EJBs with Websphere (on Linux), by now you know
that they crash the server, so that alone would drive you away from
stateful.

The more fundamental answer to your question involves the understanding
of what is a transaction in an EJB. Each method is a separate
transaction, and the methods of EJBs are designed/intended to be short
or "tiny", stand-alone transactions. So, it makes perfect sense that you
would see the container do the right thing by communicating an "end of
transaction" following a call to the EJB's method.

Here's hoping this helps. Do yourself a huge favor and wrap those JCA
connections in a stateless EJB.


Madhav Inamti wrote:

> I am performing tests on a connector using a Stateful Session EJB in
> which all remote methods have a "RequiresNew" Transaction attribute. I
> have also tried this with a "Required" attribute with the same result.
>
>
>
> After a "commit" is sent to the connector, I seem to be getting a
> ManagedConnection.cleanup()
>
>
>
> The connector 1.0 spec says that this is to clean up the state of the
> client so that the managed connection can be claimed by the app
> server's connection pool.
>
>
>
> The stateful session EJB loses all its state after a commit is sent
> since in the connector's ManagedConnection.cleanup(), a state disposal
> message is sent to the EIS.
>
>
>
> Has anybody encountered a similar issue ? Any ideas on how I can get a
> stateful session EJB to hold its state after a transaction is completed ?
>
>
>
> Thanks in advance,
>
>
>
> Madhav
>