Hi, with spring mvc 3.0.5, jboss 7.1.1 and hibernate, I am wondering how to pre-load eg. the first 10 records when my application is start-up (deployed)?
At the moment, whenever I execute a productService.findAll() for example, it always wait for a long time (10 secs) for each a page to reload.
Is there anyway "cache" the first 10 returned records somewhere in memory when the application deployed and started up?
Joined: Mar 24, 2005
Depending on how your application is structured, you can make some class/object in your application an "InitializingBean" and in its "afterPropertiesSet" method you can run the query and store the first ten results in some local variable. That method is ran right after Spring initializes your bean and injects its properties, so well before your application is totally up and ready to process requests.