aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Some basic doubts on session beans... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Some basic doubts on session beans..." Watch "Some basic doubts on session beans..." New topic
Author

Some basic doubts on session beans...

Narasimha Rao B.
Ranch Hand

Joined: Aug 26, 2002
Posts: 205
Hi,
I am having some basic doubts on session beans, please clarify them ( I know they are very silly for you)

1. What will happen if the user calls remove() method on stateless session bean ?

2. What will happen if the user is not calling any of the methods for long time, when the statefull session bean is in method ready state.
==> My understanding is - If the method is in the transaction and the user is not interacting for the specified time( defined by the container), then ejbRemove() method is called and the bean moves to 'does not exist' state.
If the method is not in the trasaction, first the bean is moved to passivate state and even after moving to the passivate state user is not calling any methods, then the bean is moved to 'does not exist' state, with out calling, ejbRemove() method -
Is this correct or not? If it is not, then please correct me

3. How can we get the transaction reference in ejbPassivate()/ejbActivate() methods -- Bec, ejbPassivate() is called only if the bean is not in the transaction. Now, if the bean is not in the transaction, how will you get the transaction references???

4. In setSeesingContext(), why can't i get the reference to the EJBObject()? Bec, EJB Object is created before creating the session context.

5. Will ejbRemove() is called, if user calles the remove() method and the bean is already passivated, i.e. bean is in passivated state.

Thanks..


Narasimha
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
1) The container ignores the remove request
2) The bean will NEVER be passivated or removed if it is in a transaction, no matter how long it has been since the client called a method. The container might call ejbRemove first, instead of calling ejbPassivate. You're right, if the bean is passivated, the container will not call ejbRemove.


Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Some basic doubts on session beans...
 
Similar Threads
ejbPassivate and ejbRemove for SFSB
Some questions
If the bean doesn't meet the requirements for passivation.
My SCEA Part 1Study Notes
releasing resources