how to add a reference to two field of one object
tongzhao May 4, 2009 11:11 PM
Address a = new Address(); a.setAddr1("aaaaaaa"); a.setAddr2("bbbbbbbbbbbb"); cache_.attach("address/1", a); Address b = new Address(); b.setAddr1("aaaaaaa"); b.setAddr2("bbbbbbbbbbbb"); cache_.attach("address/2", b); PersonWithDoubleAddress pwda = new PersonWithDoubleAddress(); cache.attach("pwda", pwda); pwda.setAddress1(a); pwda.setAddress2(a);
This is a snap .
when run to black .an error appear:
11:10:46,718 ERROR [STDERR] org.jboss.cache.pojo.PojoCacheException: PojoCache o peration will be rollback. id: /__JBossInternal__/pwda/_ID_/a28c2f-lc2jl6-fuc0wk 4f-1-fuc0wlnj-7. Operation: attach 11:10:46,718 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.PojoTxInter ceptor.invoke(PojoTxInterceptor.java:91) 11:10:46,718 ERROR [STDERR] at org.jboss.aop.advice.PerInstanceInterceptor.i nvoke(PerInstanceInterceptor.java:105) 11:10:46,718 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl$attac h_N6020276434135444173.invokeNext(PojoCacheImpl$attach_N6020276434135444173.java ) 11:10:46,718 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.CheckNonSer ializableInterceptor.invoke(CheckNonSerializableInterceptor.java:46) 11:10:46,718 ERROR [STDERR] at org.jboss.aop.advice.PerInstanceInterceptor.i nvoke(PerInstanceInterceptor.java:105) 11:10:46,734 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl$attac h_N6020276434135444173.invokeNext(PojoCacheImpl$attach_N6020276434135444173.java ) 11:10:46,734 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.CheckIdInte rceptor.invoke(CheckIdInterceptor.java:33) 11:10:46,734 ERROR [STDERR] at org.jboss.aop.advice.PerInstanceInterceptor.i nvoke(PerInstanceInterceptor.java:105) 11:10:46,734 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl$attac h_N6020276434135444173.invokeNext(PojoCacheImpl$attach_N6020276434135444173.java ) 11:10:46,734 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.PojoBeginIn terceptor.invoke(PojoBeginInterceptor.java:36) 11:10:46,734 ERROR [STDERR] at org.jboss.aop.advice.PerInstanceInterceptor.i nvoke(PerInstanceInterceptor.java:105) 11:10:46,734 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl$attac h_N6020276434135444173.invokeNext(PojoCacheImpl$attach_N6020276434135444173.java ) 11:10:46,734 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl.attac h(PojoCacheImpl.java) 11:10:46,734 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.dynamic.Cac heFieldInterceptor.invoke(CacheFieldInterceptor.java:123) 11:10:46,734 ERROR [STDERR] at org.novacrm.PersonWithDoubleAddress$address2_ Set.invokeNext(PersonWithDoubleAddress$address2_Set.java) 11:10:46,734 ERROR [STDERR] at org.novacrm.PersonWithDoubleAddress.address2_ w_$aop(PersonWithDoubleAddress.java) 11:10:46,750 ERROR [STDERR] at org.novacrm.PersonWithDoubleAddress.setAddres s2(PersonWithDoubleAddress.java:32) 11:10:46,750 ERROR [STDERR] at org.novacrm.TestList.test(TestList.java:180) 11:10:46,750 ERROR [STDERR] at org.novacrm.Test.doGet(Test.java:22) 11:10:46,750 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe rvlet.java:690) 11:10:46,750 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe rvlet.java:803) 11:10:46,750 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.internalDoFilter(ApplicationFilterChain.java:290) 11:10:46,750 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.doFilter(ApplicationFilterChain.java:206) 11:10:46,750 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilte r.doFilter(ReplyHeaderFilter.java:96) 11:10:46,750 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.internalDoFilter(ApplicationFilterChain.java:235) 11:10:46,750 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha in.doFilter(ApplicationFilterChain.java:206) 11:10:46,750 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve .invoke(StandardWrapperValve.java:230) 11:10:46,765 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve .invoke(StandardContextValve.java:175) 11:10:46,765 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssocia tionValve.invoke(SecurityAssociationValve.java:182) 11:10:46,765 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValv e.invoke(JaccContextValve.java:84) 11:10:46,765 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.in voke(StandardHostValve.java:127) 11:10:46,765 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.i nvoke(ErrorReportValve.java:102) 11:10:46,765 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnec tionValve.invoke(CachedConnectionValve.java:157) 11:10:46,765 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve. invoke(StandardEngineValve.java:109) 11:10:46,765 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.s ervice(CoyoteAdapter.java:262) 11:10:46,765 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.proc ess(Http11Processor.java:844) 11:10:46,765 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http1 1ConnectionHandler.process(Http11Protocol.java:583) 11:10:46,765 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker .run(JIoEndpoint.java:446) 11:10:46,765 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595) 11:10:46,781 ERROR [STDERR] Caused by: java.lang.IllegalStateException: PojoRefe rence.incrementRefCount(): source fqn: /__JBossInternal__/pwda/_ID_/a28c2f-lc2jl 6-fuc0wk4f-1-fuc0wlnj-7 is already present. 11:10:46,781 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoInstance.increm entRefCount(PojoInstance.java:108) 11:10:46,781 ERROR [STDERR] at org.jboss.cache.pojo.impl.InternalHelper.incr ementRefCount(InternalHelper.java:72) 11:10:46,781 ERROR [STDERR] at org.jboss.cache.pojo.impl.ObjectGraphHandler. incrementRefCount(ObjectGraphHandler.java:162) 11:10:46,781 ERROR [STDERR] at org.jboss.cache.pojo.impl.ObjectGraphHandler. setupRefCounting(ObjectGraphHandler.java:151) 11:10:46,781 ERROR [STDERR] at org.jboss.cache.pojo.impl.ObjectGraphHandler. put(ObjectGraphHandler.java:86) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheDelegate.p utObjectII(PojoCacheDelegate.java:157) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl.putOb ject(PojoCacheImpl.java:136) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl.org$j boss$cache$pojo$impl$PojoCacheImpl$attach$aop(PojoCacheImpl.java:115) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl$attac h_N6020276434135444173.invokeNext(PojoCacheImpl$attach_N6020276434135444173.java ) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.PojoTxUndoS ynchronizationInterceptor.invoke(PojoTxUndoSynchronizationInterceptor.java:42) 11:10:46,796 ERROR [STDERR] at org.jboss.aop.advice.PerInstanceInterceptor.i nvoke(PerInstanceInterceptor.java:105) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl$attac h_N6020276434135444173.invokeNext(PojoCacheImpl$attach_N6020276434135444173.java ) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.PojoTxLockI nterceptor.invoke(PojoTxLockInterceptor.java:38) 11:10:46,796 ERROR [STDERR] at org.jboss.aop.advice.PerInstanceInterceptor.i nvoke(PerInstanceInterceptor.java:105) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl$attac h_N6020276434135444173.invokeNext(PojoCacheImpl$attach_N6020276434135444173.java ) 11:10:46,796 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.PojoFailedT xMockupInterceptor.invoke(PojoFailedTxMockupInterceptor.java:46) 11:10:46,812 ERROR [STDERR] at org.jboss.aop.advice.PerInstanceInterceptor.i nvoke(PerInstanceInterceptor.java:105) 11:10:46,812 ERROR [STDERR] at org.jboss.cache.pojo.impl.PojoCacheImpl$attac h_N6020276434135444173.invokeNext(PojoCacheImpl$attach_N6020276434135444173.java ) 11:10:46,812 ERROR [STDERR] at org.jboss.cache.pojo.interceptors.PojoTxInter ceptor.invoke(PojoTxInterceptor.java:77) 11:10:46,812 ERROR [STDERR] ... 38 more