Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Serialization of Stateful Session Bean

 
ShivPrakash Srivastava
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have created a Stateful SessionBean and want to store it to the secondary storage.Do I need to implement ejbPassivate method?

The spec says that the container will call ejbPassivate() to release the held resource before the bean is passivated.Iam little confused and need some assistance from you all.

Also Can I serialize the EjbObject handle instead of the EJBObject for Passivation ?.

Thanks in Advance

Regards
Shiv
 
Rajesh K. Ilango
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateful SessionBean is not a good choice, if you want to save data to a resource manager. Passivation in Stateful SessionBean means that the server is going to remove the bean instance from the memory and serialize it somewhere. This place where beans get serialized is not a place of your choice.
ejbPassivate() is actually a callback method that the developer should use to make the bean ready for passivation.

If you want to save data into database then consider Entity beans.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic