Spring 3.0 + Hibernate 3.3.2 + JBoss Cache 2 + JTA = Fail

I've spent the past two days trying to get a distributed secondary Hibernate cache working with a Spring 3 application. The application is web-based running on JBoss 5.1 so I figured the best approach would be to use JBoss Cache, since it's automatically configured and available in JNDI when you use the "all" configuration. Hibernate 3.3.2 is configured inside of Spring using the Annotation-based session factory bean. Because I'm using JTA to manage transactions and Hibernate's current session, I need to make sure that the secondary cache, whatever I choose, is aware of the transaction manager. I originally had EHCache 2.0.1 hooked into Hibernate via Hibernate configuration parameters passed into Spring's bean. I was not setting the cache factory parameter on this bean. Everything works fine in this configuration and it recognizes the JTA transactions. ...

April 14, 2010 · 3 min · Aaron