I've written some simple application (deployed on JBoss 5.1) that uses EJB 3.0 and PojoCache 3.0.
The application tests some main functionalities of the cache (put and get methods inside transactions).
I have some simple POJO (implements java.io.Serializable + it's annotated with @Entity).
One of my tests fails. The scenario is like this:
1. Create instance of the POJO.
2. Put created object to the cache (retrieved from PojoCacheJmxWrapperMBean - service defined inside XML file).
3. New transaction: get object from the cache, change one of its fields (with setter method) and than throw RuntimeException (transaction is rolledback).
4. New transaction: check if value of modified field equals the original one (before transaction from point 3) but value is modified although transaction was rolledback.
If I add new object to the cache and rollback current transaction then everything's correct (added object is removed from the cache). Maybe @Replicable annotation is necessary but even if I annotate my POJO with it problem still occurs. I think there's some problem with AOP and "interceptors stack" related with my POJO but I added "pojocache-aop.xml" to my EJB project (META-INF directory). My log files don't contain any ERRORs. I've even checked WARNINGS but there's nothing about cache.
I've attached 2 XML files:
1. definiton of a PojoCacheJmxWrapperMBean service (located in my AS "deploy" directory)
2. pojocache-aop XML file - found in appendix part of the POJO Cache 3.0.0 docs -> I've made some modification: added new global "interceptor" element <interceptor name="SubjectInterceptor" class="org.jboss.cache.pojo.observable.SubjectInterceptor" scope="PER_INSTANCE"/> because originally it was localised inside las "bind" element (what is incorrect for JBoss 5.1 - "bind" element can contains only "interceptor-ref" elements).
Great thanks in advance.