Re: Problem with Cayenne Beta 3

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Jun 06 2003 - 00:58:41 EDT

  • Next message: Andrus Adamchik: "Re: Cayene logging:"

    Hmm... There were some changes to reverse relationship delete rules.

    I understand that "comp" is also a DataObject, right? What delete rule
    is set on relationship from "comp" to "compKpi"? If it is "NULLIFY",
    Cayenne will automatically remove deleted object from the to-many
    collection. And this happens at the same exact time as the iteration
    over the same collection, hence - an exception.

    So you may need to clone the list before iterating over it:

    > List compKpiList = comp.getHasKpis();

    becomes

    List compKpiList = new ArrayList(comp.getHasKpis());

    Andrus

    On Wednesday, June 4, 2003, at 04:03 AM, Martin Ruff wrote:

    > Hi,
    > We've just switched from cayenne-1.0b1.jar to cayenne-1.0b3.jar in our
    > application and now we do have problems with code that worked before.
    > We
    > do not know if it is a bug in our application or it is a new cayenne
    > feature.
    > for example here:
    > List compKpiList = comp.getHasKpis();
    > for (Iterator iter = compKpiList.iterator(); iter.hasNext();) {
    > CmCompKpi compKpi = (CmCompKpi) iter.next();
    > comp.getDataContext().deleteObject(compKpi);
    > }
    > comp.getDataContext().commitChanges(Level.WARN);
    >
    > we get:
    >
    > java.util.ConcurrentModificationException
    > at
    > java.util.AbstractList$Itr.checkForComodification(AbstractList.java:444
    > )
    > at java.util.AbstractList$Itr.next(AbstractList.java:421)
    > at
    > com.winterthur.cm.controller.LocalKpiManager.deleteAllCompKpi(LocalKpiM
    > anager.java:252)
    > at
    > com.winterthur.cm.view.CompetitionSaveAction.updateCompKpi(CompetitionS
    > aveAction.java:342)
    > at
    > com.winterthur.cm.view.CompetitionSaveAction.cmExecute(CompetitionSaveA
    > ction.java:176)
    > at com.winterthur.cm.app.CMBaseAction.execute(CMBaseAction.java:65)
    > at
    > org.apache.struts.action.RequestProcessor.processActionPerform(RequestP
    > rocessor.java:465)
    > at
    > org.apache.struts.action.RequestProcessor.process(RequestProcessor.java
    > :274)
    > at
    > com.winterthur.cm.app.CMRequestProcessor.process(CMRequestProcessor.jav
    > a:33)
    > at
    > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1393)
    > at
    > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    > at
    > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
    > ationFilterChain.java:247)
    > at
    > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
    > terChain.java:193)
    > at
    > com.winterthur.cm.utils.Principal2CmUserFilter.doFilter(Principal2CmUse
    > rFilter.java:47)
    > at
    > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
    > ationFilterChain.java:213)
    > at
    > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
    > terChain.java:193)
    > at
    > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
    > ve.java:260)
    > at
    > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
    > invokeNext(StandardPipeline.java:643)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 480)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    > at
    > org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal
    > ve.java:191)
    > at
    > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
    > invokeNext(StandardPipeline.java:643)
    > at
    > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticato
    > rBase.java:493)
    > at
    > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
    > invokeNext(StandardPipeline.java:641)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 480)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    > at
    > org.apache.catalina.core.StandardContext.invoke(StandardContext.java:24
    > 15)
    > at
    > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav
    > a:180)
    > at
    > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
    > invokeNext(StandardPipeline.java:643)
    > at
    > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherV
    > alve.java:170)
    > at
    > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
    > invokeNext(StandardPipeline.java:641)
    > at
    > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav
    > a:172)
    > at
    > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
    > invokeNext(StandardPipeline.java:641)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 480)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    > at
    > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve
    > .java:174)
    > at
    > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
    > invokeNext(StandardPipeline.java:643)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 480)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    > at
    > org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    > at
    > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:4
    > 32)
    > at
    > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process
    > Connection(Http11Protocol.java:386)
    > at
    > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:5
    > 34)
    > at
    > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPoo
    > l.java:530)
    > at java.lang.Thread.run(Thread.java:536)
    >
    > We suppose that the behaviour of
    > comp.getDataContext().deleteObject(compKpi); has changed between
    > cayenne-1.0b1.jar and cayenne-1.0b3.jar, is this correct, and if so
    > what
    > is the correct use?
    > thanks for help
    > martin
    >
    >
    >
    > -------------------------------------------
    > Be the change you want to see in the world.
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Jun 06 2003 - 00:57:25 EDT