I am developing a tool for my team. This a tool which is used for monitoring purpose(restricted explanation). Even if "n" number of users are logged to the system, the data displayed to the users will be same irrespective of the users. These details are queried from the database and displayed to the user. But this data is not static always. This will be changing each one hour. Means, in the back end a scheduler is running which is updating the DB in every hour.
So, for a particular period of time (maximum 1 hour), the data will be constant. As per the current design, for each user i am querying the DB and displaying the details. This is nothing more than performance reduction.
I am using JSP to display the details. Is there any mechanism to query the db and put the data in cache or some where else(this should get updated in each hour) so that i can use those values without having a db connection?
Note : I do not want the details to be stored in text,xml,CSV etc.
You can simply implement a caching mechanism yourself. Search for Implementing Caching in google. This singleton class cache you can store in Application context , thus it will be accessible from any user login. Or rather than storing in context you can just make it a singleton class initialized in a separate Servlet (Call it a ApplicationInitializerServlet) which gets loaded up when application is loaded in Servlet container. In the cache class you can create a Thread (You can use a Schedulre or timer class or New ThreadExecutor class in java 5) to create a scheduler thread which will keep on looing for any change in the particular DB you are expecting data to change , As soon as it finds new updates in DB yuor thread can invoke JDBC calls to update the cache class object.
You can use HashMap or HashTable as per your convenience.
Also if you want you can use Hibernate to do all this caching and periodic lookup of database change. It relieves you of creating a continuous running thread to monitor DB change. As soon as any table data changes the Hibernate cache objcets are updated on their own.
but i will advise avoid Hibernate for this small requirement and create your own Cache classes.
There's no need to re-invent caching. There are some perfectly good pre-built (and pre-debugged) resources at jakarta.apache.org. In fact, I think that you'll find them being used as the caching mechanism for both open-source ORM products like Hibernate and commercial ones.
Customer surveys are for companies who didn't pay proper attention to begin with.