This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Stateful Session Beans and transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Stateful Session Beans and transactions" Watch "Stateful Session Beans and transactions" New topic

Stateful Session Beans and transactions

Rowan Mayfair

Joined: Sep 24, 2007
Posts: 1
I was wondering that if say a container managed trasanction starts with StatelessSessionBean A -> which then calls StatefulSessionBean B create method. Later during the same transaction another method calls the create method on StatefulSessionBean B, will the same StatefulSessionBean with the same state be returned from the first call? Or will the second or any subsequent create calls within the same transaction to the StatefulSessionBean just create a brand new instance as if coming from a different client?

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Stateful session beans are tied to a single session - one principal cannot have two instances of a specific bean. If a client makes a call to a SFSB and the same client makes another call before the method has returned (i.e. if the client is multithreaded) you will get an exception since concurrent calls to SFSBs is prohibeted by the spec.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Stateful Session Beans and transactions
It's not a secret anymore!