aspose file tools*
The moose likes Java in General and the fly likes ValueListHandler - large data set problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "ValueListHandler - large data set problem" Watch "ValueListHandler - large data set problem" New topic
Author

ValueListHandler - large data set problem

Ajaz A
Greenhorn

Joined: Jan 15, 2007
Posts: 21
I'm working on an application which, like many, displays a subset of a large data set with Next Page/Previous Page links. This seemed like a perfect application of the Value List Handler pattern.

My question, however, is this. It mentions that the Value List Handler is cached on the server side. Where is a good place to cache this list? One of the requirements of the application I'm working on is that the amount of "stuff" placed in the user's session should be minimized. Also, the number of user working concurrently is huge. So I cannot use a session bean strategy of VLH.

Is the user's session the only place that makes sense for this? Or is there somewhere else it can be cached and tied to that particular user?

If I dont keep the data in a cache then I need to re execute the query for next subset of data. So I have to keep it as statefull. This again creates a overhead since there will be lot of users.

Thanks in advance for your help...


SCJP (310-035) 84% | SCEA 91%
Ajaz A
Greenhorn

Joined: Jan 15, 2007
Posts: 21
Any comments..please.
Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361
You can store the cache on whatever place you see suitable. For example you can store it in the user session or you can store the data in an XML file on the server. Any solution that makes the best performance is welcome.
[ November 28, 2007: Message edited by: Khaled Mahmoud ]

SCJP, SCJD,SCWCD,SCDJWS,SCEA 5 MCP-C#, MCP-ASP.NET - http://www.khaledinho.com/
Life is the biggest school
Juan Pablo Crossley
Ranch Hand

Joined: Oct 16, 2007
Posts: 128
Originally posted by Khaled Mahmoud:
You can store the cache on whatever place you see suitable. For example you can store it in the user session or you can store the data in an XML file on the server. Any solution that makes the best performance is welcome.

[ November 28, 2007: Message edited by: Khaled Mahmoud ]


WoooooooooooooW .... the file store is not a good practice remember... the design of your application must consider the cluster situation, in that case you can't use the disk as session storage. btw, the specification forbids that, if you use the java.io to store files you could lead to a non compliant application.

about your answer, use the http session because it will be forwarded to other servers if you are in a cluster environment, avoid the static variable solution due to the same problem.


SCJP, SCBCD, SCEA 5, MCP

How to pass SCEA 5 | 2, 3, N-tier which one should I pick? | Analysis of persistence layer from SCEA 5 perspective | Swing... why not?
David Sheth
Greenhorn

Joined: Dec 16, 2001
Posts: 17
You mentioned
If I dont keep the data in a cache then I need to re execute the query for next subset of data.


However, if your dataset is large, and you have a large number of users, you may run out of memory if you store a large dataset for each user. Instead, you may want to take advantage of the built in pagination features of EJB3/JPA--in particular, the setMaxResults and setFirstResults methods. You would need to run a new query for each page that a user sees, but your memory consumption would be much less. This is a tradeoff that we make in our applications for large lists.


SCJP, SCWCD<br /><a href="http://eclecticprogrammer.com" target="_blank" rel="nofollow">eclecticprogrammer.com</a>
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11462
    
  94

This has nothing to do with the Sun Certified Enterprise Architect exam or assignments. This may be one of the reasons you got no responses last time you posted this, and it took so long to get a response this time - you were asking the question to people who were coming to this forum for another reason.

I am therefore moving this topic.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
...the Value List Handler pattern...

Seems to me that if you look at the Figure 8.30, all the participants except for the Client are EJBs managed by a container in the persistence layer and in a process separate form the Client.

The ValueList is an entity bean.

The DataAccessObject is a stateless session bean.

The ValueListHandler is a stateful session bean returned from the DataAccessObject.

I haven't tried to parse the code in that example because I assume that it's pre JavaEE 5.0.
[ November 28, 2007: Message edited by: Bill Shirley ]

Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ValueListHandler - large data set problem