Hi Andrus,
the previous thread has nothing to do with unregistered objects.
Ok, not using unregisterObject results in not deleting anything at all :-(
So if I use "deleteObject" it simply deletes my object as required, but the
other object which is in state "DELETED" isn't removed as well.
Thanks a lot,
Jan
From: Andrus Adamchik <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: Temporary objects
Date: Tue, 14 Aug 2007 16:20:18 -0400
Hi Jan,
In any event I would advise against using "unregisterObjects", unless you
are sure there are no remaining cached objects that point to unregistered
objects via a relationship.
So if you are using "unregisterObjects" to save memory, I suggest simply
throwing away the DataContext and replacing it with a new one (or use
Cayenne 3.0M1 that would clean up unused registered objects for you).
Andrus
P.S. So could you tell whether the problem described in the previous
thread is also caused by unregistering?
On Aug 14, 2007, at 11:35 AM, Jan Lendholt wrote:
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!