Problem commiting changes back to database

From: Paul Logasa Bogen II (pl..amu.edu)
Date: Wed Mar 04 2009 - 11:20:58 EST

  • Next message: Michael Gentry: "Re: Problem commiting changes back to database"

    I hate to write such a vague message but after googling for a day I
    don't seem to be getting anywhere debugging an exception I'm getting
    when I try commit changes to a CayenneDataObject back to the database
    using Cayenne 3.

    Here is the line of my code where the exception occurs under:

    this.ctxt.commitChanges();

    ctxt is my DataContext which is defined further up in the class like this:

    private DataContext ctxt = DataContext.createDataContext(true);

    Here is the exception itself:

        Root cause:

        java.lang.ClassCastException:
        org.apache.cayenne.reflect.generic.DataObjectToOneProperty cannot be
        cast to org.apache.cayenne.reflect.ToManyMapProperty at
        org.apache.cayenne.access.DataDomainSyncBucket.postprocess(DataDomainSyncBucket.java:242)
        at
        org.apache.cayenne.access.DataDomainFlushAction.postprocess(DataDomainFlushAction.java:241)
        at
        org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:149)
        at
        org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:820)
        at
        org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:787)
        at
        org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:846)
        at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:784)
        at
        org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1171)
        at
        org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1073)
        at edu.tamu.csdl.dcm.util.Store.commit(Store.java:173) at
        edu.tamu.csdl.dcm.ui.actions.SaveAction.onClick(SaveAction.java:32)
        at
        org.wicketstuff.yui.markup.html.menu2.YuiMenuItem$1.onClick(YuiMenuItem.java:31)
        at
        org.apache.wicket.ajax.markup.html.AjaxFallbackLink$1.onEvent(AjaxFallbackLink.java:73)
        at
        org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
        at
        org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
        at
        org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
        at
        org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
        at
        org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271) at
        org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370) at
        org.apache.wicket.RequestCycle.request(RequestCycle.java:501) at
        org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
        at
        org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
        at
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at
        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at
        org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at
        org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
        at
        org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at
        org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
        at
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
        at
        org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        at
        org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        at
        org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        at
        org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
        at java.lang.Thread.run(Thread.java:619)

        Complete stack:

        org.apache.cayenne.CayenneRuntimeException: [v.3.0M5 Dec 09 2008
        01:43:15] Commit Exception at
        org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1199)
        at
        org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1073)
        at edu.tamu.csdl.dcm.util.Store.commit(Store.java:173) at
        edu.tamu.csdl.dcm.ui.actions.SaveAction.onClick(SaveAction.java:32)
        at
        org.wicketstuff.yui.markup.html.menu2.YuiMenuItem$1.onClick(YuiMenuItem.java:31)
        at
        org.apache.wicket.ajax.markup.html.AjaxFallbackLink$1.onEvent(AjaxFallbackLink.java:73)
        at
        org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
        at
        org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
        at
        org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
        at
        org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
        at
        org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271) at
        org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370) at
        org.apache.wicket.RequestCycle.request(RequestCycle.java:501) at
        org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)

    If someone has an idea or if ya'll want to see more. Just let me know.
    Of course if using version 3 now is just daft let me know that too. :-P

    plb



    This archive was generated by hypermail 2.0.0 : Wed Mar 04 2009 - 11:22:30 EST