[jboss-user] [JBoss Cache: Core Edition] - attach()detach() can transaction, but find() can not?

wj.king do-not-reply at jboss.com
Tue Apr 22 21:58:41 EDT 2008


I'm sorry ask the same here,- -, no answer in the pojo-edition:)
hi all, 
when i use as the below ,i can rollback the cache: 

  |         clientDao.insertClient(client);
  |         Client clientCache = clientDao
  |                     .getClientByName(client.getName());
  |         //cacheManager.insertClientToCache use pojocache.attach(id,client)
  |         cacheManager.insertClientToCache(clientCache);
  |         throw new RuntimeException();
  | 
or 

  |         clientDao.deleteClientByTid(tid);
  |         //cacheManager.deleteClientByTid use pojocache.detach(id)
  |         cacheManager.deleteClientByTid(tid);
  |         throw new RuntimeException();
  | 	 

they work fine, but when i use pojocache.find(...) to get a pojo,then i modified the name field, it can't rollback, 

  |         clientDao.updateClient(client);
  |         Client cInCache = cacheManager
  |                     .getClientFromCacheByTid(client.getTid());
  |         cInCache.setName(client.getName());
  |         throw new RuntimeException();
  | 
when the up is done,clientDao.updateClient rollbacked,but the client in cache ,it's Name field not rollback, 

i've placed jboss-aop.jar to my web/WEB-INF/lib,and copyed one pojocache-aop.xml(from jbosscache-pojo.jar/METE-INF/) to web/WEB-INF/classes, 

i've read the userguide doc, 
from the Chapter6.Instrumentation , i don't know how i do the below in a web application server, e.g.; tomcat 


  | 
  | The jboss.aop.path system property set to the location of pojocache-aop.xml 
  | 
  | A javaagent argument which includes jboss-aop-jdk50.jar 
  | 
  | These requirements lead to the following example ant task: 
  | 
  | 
  | <java classname="Foo" fork="yes">
  |    <jvmarg value="-javaagent:lib/jboss-aop.jar"/>
  |    <jvmarg value="-Djboss.aop.path=etc/META-INF/pojocache-aop.xml"/>
  |    <classpath refid="test.classpath"/>
  | </java>
  | 
  | There is also a pojo-run command line script in the POJO Cache distribution that passes the proper a
  | rguments to the JVM for you. 
  | 
  | 
  | $ pojo-run -classpath myclasses org.foo.Bar
  | 
  | Once the JVM is executed in this manner, any class with the @Replicable annotation will be instrumen
  | ted when it is loaded. 	
  | 
then in 5.3 AOP Configuration

  | POJO Cache supplies a pojocache-aop.xml that is required to be set via a system property: jboss.aop.
  | path during compile- or load-time, or 
  | placed in the user's classpath
  | . The file now consists of the interceptor stack specification, as well as annotations for POJO inst
  | rumentation. It is listed fully in the Appendix section. Note that the file should not normally need
  |  to be modified. Only an advanced use-case would require changes.
  | 
so, in web server ,if i placed jbosscache-aop.jar(and other requied jar) to WEB-INF/lib and pojocache-aop.xml to WEB-INF/classes, then pojocache can work fine? 
i've done this,but ,use find() to get a object from cache,i can't rollback the field, 
Have i forgot something important?

how can i now to do?Any advice would great appreciate

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146011#4146011

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146011



More information about the jboss-user mailing list