File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes reg Value List Handler Pattern !!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "reg Value List Handler Pattern !!!!" Watch "reg Value List Handler Pattern !!!!" New topic

reg Value List Handler Pattern !!!!

Giju George
Ranch Hand

Joined: Jun 08, 2004
Posts: 333
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?

SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCEA
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 446
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

Joined: Jun 08, 2004
Posts: 333
According to the diagram at , 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

Joined: Jun 23, 2003
Posts: 16
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
I agree. Here's the link:
subject: reg Value List Handler Pattern !!!!
jQuery in Action, 3rd edition