I am using jboss cache as in memory database with persistent mechanism as JDBM.
I have multiple cache instances each having own private data.
For the database i am using spring with hibernate.
My question is how can i put both cache manipulation and hibernate database actions under a single transaction.
I mean if the database transaction fails, then the cache updates should be rolled back and vice versa.
Please help me.
Thanks in advance.
You can make them share the same TransactionManager instance, and this way cache will register itself to existing transactions associated with the thread. Take a look at TransactionManagerLookup