| Author |
Scope of an EJB session
|
Anuradha Karunamuni
Ranch Hand
Joined: Dec 08, 2007
Posts: 64
|
|
I am accessing an EJB module from an external web module. The process is comprised of two phases. The first phase ends when a method call of a stateful session bean returns its value to the web module and that point onwards the second phase starts. Phase 02 needs to invoke another method of the same stateful session bean instance as the previous phase. Is it possible to consider both the phases as one session in an EJB perspective? If yes, how do I make sure if the stateful session bean instance which is being accessed in phase 02 is same as the instance which is being accessed in phase 01? Or else will I have to consider two phases as two different EJB sessions? Thanks in advance.
|
"Simplicity is the ultimate sophistication..." ~Leonardo da Vinci~
SCJP 1.4
|
 |
Reza Rahman
author
Ranch Hand
Joined: Feb 01, 2005
Posts: 559
|
|
Anuradha, Stateful session beans are designed for the specific use-case you are mentioning. You don't have to do anything else other than to make sure you hold on to the same stateful session bean reference across calls. Regards, Reza
|
Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
|
 |
Anuradha Karunamuni
Ranch Hand
Joined: Dec 08, 2007
Posts: 64
|
|
|
It worked...Thanks.
|
 |
 |
|
|
subject: Scope of an EJB session
|
|
|