Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

newbie question - stateful or stateless bean?  RSS feed

 
Chris Spiteri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing an online catalogue website with a database containing items for sale. I thought of writing a CatalogueBrowser facade bean that interacts with the entity beans which in turn would pull out data from the database. The JSP page would then call the appropriate method from the CatalogueBrowser facade to start a chain of method-calling that would propagate through the entity beans and end up with an array of ItemDetail objects to display in the JSP page.
I am confused on whether I should set the CatalogueBrowser bean (i.e. the facade) as stateful or stateless. I *think* it should be stateless, since it only returns the array of ItemDetail objects and doesn't store anything inside it, but I would like either a conformation of this...or else a good telling-off because I am doing everything upside down and how things should be. Thanks!
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How many items do you expect in your catalog? Chances are you don't want to access them through entity beans because you will be loading entity beans and storing them in and out of the container. Your performance will suffer. You probably want to search the db directly for catalog items.
A catalog might even be better implemented with an LDAP server.
It sounds like a stateless bean.
HTH
[ January 20, 2004: Message edited by: Rufus BugleWeed ]
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other day, I came across this J2EE Design pattern - Value List Handler Pattern...I have not used this, but maybe this could help..
http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!