I had posted this on the user mailing list but didnt get a response.
In my application I have a read mostly scenario where users work on data in batches (monthly data) . So, I thought that caching query results could improve performance a lot.
I've tried to modify the JBoss 3.2.2RC3 source to add this feature in the following manner:
I've defined a cache to hold the results - with the key as the ejbName.query.queryparams and value as collection of results.
I also store a mapping of all other ejbs involved in the query so that when they are modified this query is flushed from the cache.
This cache object is a static variable in the EntityContainer class.
In my case I'm using cache invalidation so i've modified the InvalidableInstanceCache to clear the entries for the modified entity class whenever a create,update,delete happens for an entity.
In the JDBCAbstractQueryCommand, the execute method i first look in the cache before running the sql query and then if the sql is run i add the results to the cache.
So far it seems to be working fine but I would appreciate the inputs of JBoss developers in case i've missed something here