Temporary objects

From: Jan Lendholt (jlendhol..otmail.com)
Date: Tue Aug 14 2007 - 11:35:02 EDT

  • Next message: Andrus Adamchik: "Re: Temporary objects"

    Hey Folks,

    me again with yet another problem which in my opinion seems to me as a bag
    in cayenne.

    Ok, the situation:

    Create a dataset A, save (commit) and close the application. Then open the
    application and create a dataset B - do NOT save (commit) Changes and delete
    dataset A and dataset B.
    Dataset A ist deleted by using context.deleteObject(objA) and dataset B ist
    deleted by unregisterObjects(temp) where temp is a collection withe objB in
    it.

    Now on the commit of the changes we get an exception:

    17:22:09.208 WARN!! Exception for /ams?serviceId=Echo.Synchronize
    java.lang.NullPointerException: Attempt to add null target DataObject.
            at
    org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:263)
            at
    org.apache.cayenne.access.ChildDiffLoader.arcCreated(ChildDiffLoader.java:111)
            at
    org.apache.cayenne.access.ObjectDiff$ArcOperation.apply(ObjectDiff.java:428)
            at org.apache.cayenne.graph.CompoundDiff.apply(CompoundDiff.java:97)
            at
    org.apache.cayenne.access.ObjectStoreGraphDiff.apply(ObjectStoreGraphDiff.java:136)
            at
    org.apache.cayenne.access.DataContext.onContextFlush(DataContext.java:1180)
            at org.apache.cayenne.access.DataContext.onSync(DataContext.java:1159)
            at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1226)
            at
    org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1130)
            at
    ams.lieferanten.LieferantenCreateWindowPane.actionSave(LieferantenCreateWindowPane.java:280)
            at
    ams.lieferanten.LieferantenCreateWindowPane.access$4(LieferantenCreateWindowPane.java:236)
            at
    ams.lieferanten.LieferantenCreateWindowPane$7.actionPerformed(LieferantenCreateWindowPane.java:489)
            at
    nextapp.echo2.app.button.AbstractButton.fireActionPerformed(AbstractButton.java:135)
            at echopointng.ButtonEx$1.actionPerformed(ButtonEx.java:120)
            at
    nextapp.echo2.app.button.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:70)
            at
    echopointng.model.DefaultButtonModelEx.doAction(DefaultButtonModelEx.java:51)
            at echopointng.ButtonEx.processInput(ButtonEx.java:203)
            at
    nextapp.echo2.app.update.ClientUpdateManager.process(ClientUpdateManager.java:116)
            at
    nextapp.echo2.app.update.UpdateManager.processClientUpdates(UpdateManager.java:89)
            at
    nextapp.echo2.webcontainer.ContainerSynchronizeService.renderUpdate(ContainerSynchronizeService.java:472)
            at
    nextapp.echo2.webrender.service.SynchronizeService.service(SynchronizeService.java:279)
            at
    nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
            at
    nextapp.echo2.webrender.WebRenderServlet.doPost(WebRenderServlet.java:189)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
            at
    org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:342)
            at
    org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:91)
            at
    org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
            at
    org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
            at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1776)
            at
    org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:514)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1726)
            at org.mortbay.http.HttpServer.service(HttpServer.java:879)
            at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
            at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
            at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
            at
    org.mortbay.http.SocketListener.handleConnection(SocketListener.java:196)
            at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
            at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:487)

    I tried to track it back and found out, that on unregisterObjects the
    objects are being thrown out of the objectStore. Therefore we get a Null
    value when searching for the object on commit.
    Now we tried the "deleteObject" method to delete the objB which has the
    state NEW. Neither dataset (objA, objB) is deleted. I am wondering why.

    We are just holding some objects temporarily in the samte context with
    alread saved data in the database.

    Is it a bug?

    Thanks in advance!

    Jan

    _________________________________________________________________
    Sie suchen E-Mails, Dokumente oder Fotos? Die neue MSN Suche Toolbar mit
    Windows-Desktopsuche liefert in sekundenschnelle Ergebnisse. Jetzt neu!
    http://desktop.msn.de/ Jetzt gratis downloaden!



    This archive was generated by hypermail 2.0.0 : Tue Aug 14 2007 - 11:35:42 EDT