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...
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.
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.
I am therefore moving this topic.
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 ]