• Post Reply Bookmark Topic Watch Topic
  • New Topic

Stateful entity beans in design  RSS feed

 
rastin purr
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If a program uses stateful entity bean by creating one and putting it in the http session to keep track of user. Is that a good idea? or is it better to look it up using other methods?
If the stateful entity bean is placed into the http session. Is it still necessary to remove it when exit or is it enough to remove the http session and it will be removed.
Please give advice. Thank you very much.
Ras
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First off, there is no such thing as a stateful Entity Bean. There is an Entity Bean or a Stateful Session Bean though.
I assume you are referring to a Stateful Session Bean. Yes this is a valid choice to track user session. You wouldn't put the bean in the HttpSession though, you would put the bean's handle in the session.
One question: Why not just use the HttpSession? Will you have other types of clients besides web clients where you need to track state? If not then I suggest just using the HttpSession.
 
rastin purr
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks chris,
I have entity beans and stateless session beans dealing with business logic. and stateful session beans representing diferent kinds of users with diferent privilege. Is this suitable? Because each stateless session beans performs some related business logic. Say 4 of thems, then do u suggest that i have a java beans that look up the stateless session bean and have the java bean in the httpsession?
Could you explain more about puting the handle instead of the reference please? thanks. If the httpsession gets invalidated will the stateful session bean get invalidated as well or will it still persis and need to remove it?
One more questions, is it good practice to create a stateless session bean wherever its service is needed? because stateless session beans could be resuse so, i think it is ok. What do u guys think?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!