• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stateful entity beans in design

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic