• 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

reg Value List Handler Pattern !!!!

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
I am busy preparing for my part 1, but as I move along, I am also grabbing as much knowledge that I can for the part-2 and 3. This is quite helpful in doing a design work for my current project too.

My question is :-
I am busy understanding the petstore architecture. I have been going thru the catalog module which is using Fast Lane Reader, View Helper, ValueList Handler patterns. I am a bit confused with the VLH pattern. According to perstore, the VLH pattern allows us to display information in chunks. But if you look at the code, the method that returns the Page (Value List) in Helper class is accessing the database each time you scroll next or prev. Isn't this consuming resources at the server side by accessing db ?.

Also they are using a cache tag, that caches every page that displays the information. Isn't this an efficient way that the VLH?. And if we cache the page with all the information, then why do we need to implement the VLH pattern?
 
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are different ways in which you can implement ValueListHandler design pattern:

1. Using SFSB, which gets everything in one go from the database and then provides by page by page data to the client.

2. Using SLSB or POJO class which gets the data from the database. This approach executes the same SQL at the database level in such a way that a subset is returned back to the SLSB or POJO class. (recommended in Bitter EJB book as the best approach)

3. Third option is to run the sql and store the page by page response in the database. Then provide page by page data back to the user. (have read something about this at ibm's developer site).

I have used approach #2 in my projects and it provides excellent performance.
 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the diagram at ,http://java.sun.com/blueprints/corej2eepatterns/Patterns/images08/figure08_30.gif it should access the database only once. And subsequent queries should get the results from the ValueList (Page in petstore). But if you look at the petstore code, its accessing the db to get each subset.

So, where is the caching done.... ???

[ May 30, 2005: Message edited by: Giju George ]
[ May 30, 2005: Message edited by: Giju George ]
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Depak ,
U suggested for SLSB for the VLH. So for Flight and I wanna make
query on that so do i need to make Flight SLSB instead of Entity ?

or Flight will be Entity and we need have another SLSB.

can u put some lights on that
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic