This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reg Value List Handler Pattern !!!!

 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • 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?
 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
sys alley
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic