I want use JBossCache to store information (as cached data) in the same transaction.
I know that I can do it..
I have a class A that retrieve some information, it's call class B and this calls can get info from cache (stored from A) and so on..
But all this object in the cache must be removed at the end of the transaction (when A finish).
I know that if i put my code in class A to remove all... it's simple.. but I want know if there is a way to do it automatically (when the transaction ends with commit or rollback, all entry in the cache will be removed)
I see the Transaction management for JBoss Cache.. but in this case if at the end I have a commit, entry are really stored in the JbossCache, and only if there is a roolback they are not stored...
Can you write out some code as an example?