Using Global Caches in a Transactional Context

When a global cache is used in a transactional context, care must be taken to ensure that the cache maintains its consistency in case the current transaction is rolled back.

Cache invalidation in a transactional context: When modifying data that affects the content of a cache do not remove or update the cached element directly; instead invoke the CacheManagerEjb.postInvalidationMessage() method to post an invalidation message that will trigger the cache invalidation.