I use JBoss AS. I have a long and heavy SQL that run inside the application server. I want to cache the results based on input parameters.
I have a few options here:
Use a caching manager and manually putting the results in the cache.
Use a caching manager with loader that will "load" the results into cache when there's no results in cache.
I don't care for now about replication of the cache to other servers in cluster.
My question is what option should I choose? What are the benefits and drawbacks of each option. (ease of deployment, configuration mess)
Is this can be implemented using JBoss Cache or ehcache or both.
Update: I am using hibernate but the results are not entities, they are counters. I need to count all rows that belong to specific category and have specific status. I want that result to be cached.
Should I wrap the results inside an entity? Then, how can I make it work like (materialized?) view in oracle - to be update automatically or by trigger.