• Post Reply Bookmark Topic Watch Topic
  • New Topic

A Design Issue :confused:  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I�m trying to implement a catalog where a user browse/search through different categories and reach a list of suppliers under a particular category. Again a supplier may have different types of products under that category and finally a set of products. I tried storing the entire structure (suppliers , categories under him , products under these categories) in a bean and store in session. But designing the bean was not difficult and it became quite heavy holding all those Supplier objects and hundreds of product objects. I used Hashtables to store Supplier / Product objects. Is this the right way of doing ? Is there any simplified way of storing the catalog information in session so that I can minimize database calls? Any pattern I can implement here ?
------------------
San..
 
Sheriff
Posts: 11556
181
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See if the Data Access Object pattern will help. I think it's somewhere on the IBM developerWorks website.
Junilu
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am assuming that you are using EJB technology.You can use Value Objects if your bean only has setter/getter methods.Also you Session Bean can be based on FACADE PATTERN to you entity Beans - You can aggregate the getter/setter's as one object and send it to the client.The Data Access Object (DAO) could be used, if you are having lots of JDBC calls in your EJB Bean.By keeping this class seperate, your EJB Bean looks cleaner.
Hope this helps,
Sandeep
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure in the context of EJBs, but the problem seems to lend itself to the Composite/Iterator patterns (searching through trees or hierarchies)... A supplier will have category nodes under him which will have product nodes under them and so on... with leaf nodes (individual items) at the end.
Hope it helps.
Sanjeev
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have explosion of objects, I would guess u shoud do serach by some criteria (some key), and cache it in form of entity beans.
I am not sure if any Pattern will help here. I remeber flyweight helps manage lot of objects.
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.javaworld.com/javaworld/jw-05-2001/jw-0504-cache.html
see above link for a cool, new tag library that will cache in the server session, any object.....any period of time....
this is not an EJB solution however, strictly JSP/Servlets...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!