Question

We are using Infinispan (clustered using JGroups) as our second level cache in our JPA(Hibernate) based application. When a database operation fails, we see that the level-2 cache is stale. For example:

1) Attempt to create a user with login "joe." 2) Call persist(user); 3) persist fails due to database uniqueness constraint. 4) Do a find by id on login=joe (assuming login is the PK). 5) Hibernate returns joe user from Infinispan cache, even though database doesn't have it.

Configuring XA transactions and have Infinispan participate in XA seems like overkill in this situation. Is XA the only way to address this?

Was it helpful?

Solution 2

I had to enable XA transactions by deploying Atomikos to keep the cache in sync. Other solutions did not work.

OTHER TIPS

Enable transaction synchronization, much cheaper than XA.

See http://infinispan.blogspot.com/2011/06/faster-infinispan-based-second-level.html for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top