Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

A Design Issue :confused:

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 16910
283
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic