• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to store state in statefull session bean

 
gourav chouhan
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I have a stateful session bean
but when a client calling method deposit, the value of balance is initializing by 0 every time a client makes a request
that is it is not storing the state so what do i do ?
please help me
 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateful session bean will maintain the conversational state as long as the remote reference to it OR its state is stored using EJB Handle.

1. Keep a reference to the stateful session bean between requests in HTTP Session.

2. Serialize the handle to the bean, and then pass this serialized handle to the client in a cookie or persist it in the database. You can also store the handle in session using a key and pass the key as a cookie.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!