Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Passivation

 
rania ferrag
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every one,

Can some one answer the question bellow, and if you can give some details that could be great !

Which of the following properties are saved at the time of EJB Passivation

A-EJBHome reference
B-Transient Variables
C-User Transaction
D-NamingContext
E-EJBObject reference

THanks and Regards,

Rania
 
Mahesh Desai
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A, C, D & E are correct answers.

B is incorrect: Passivation (serialization) skips the variables of the bean class which are declared as transient while storing the object on secondary storage.

By the completion of the ejbPassivate() method, all the nontransient fields (which will be saved) of the bean state must be one of the following:

1] A serializable object, that is, its class implements the Serializable interface.
2] Null.
3] A reference to an enterprise bean�s remote component (EJBObject) interface or remote home (EJBHome) interface.
4] A reference to an enterprise bean�s local component(EJBLocalObject) interface or local home (EJBLocalHome) interface.
5] A reference to a SessionContext object.
6] A reference to the bean�s JNDI context (for example, java:comp/env) or any of its subcontexts.
7] A reference to a user transaction interface: javax.transaction.UserTransaction.
8] A reference to a resource manager connection factory, for example, javax.sql.DataSource.
9] A reference to a javax.ejb.Timer object.



Hope this helps,


Thanks,
Mahesh



----------------------
SCJP 1.4 | SCWCD 1.4 | SCBCD 1.3 | SCEA Part I - In Progress
[ May 08, 2007: Message edited by: Mahesh Desai ]
 
rania ferrag
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mahesh !!

Thank you so much for your prompt response, I'll make sure to memorize the case you mentioned above.

My Best Regards

Rania
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
During passivation of entity beans nothing is saved , its only put back to the pool.

In case of stateful session bean , during passivation everything that you have mentioned is saved.The only thing is that it doesnot guarantee the correct values during activation of transient variables.So you should take care of it.
 
rania ferrag
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rahul for your answer, But I'm confused, I thought that for an entity bean we save the data to the underlying DB before passivating the instance entity bean, the container call ejbStore() before passivating the bean... Can some one clarify this please ?

Also the Transient field are not saved , right ?

If any comment on this and clarification, will be help me ...

Thank you all for your help,

My Regards,
Rania
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Passivation , activation , ejbCreate , ejbRemove have completely different meaning for entity beans and stateful session beans.

I am talking about the objects that you have mentioned in your initial post.During passivation of stateful session beans you need to take care of transient variables during activation as because its not guaranteed that it would be set to default values.
 
rania ferrag
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank Rahul for your quick reply
You said
During passivation of entity beans nothing is saved , its only put back to the pool.

So only for Stateful sessionbean, where the state are saved ?

Rania
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by rania ferrag:
Thank Rahul for your quick reply
You said
So only for Stateful sessionbean, where the state are saved ?



No , for stateful session beans the objects that you have mentioned in the initial post are taken care by the container , rest of the stuffs you have take care.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic