cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcin Skladaniec <mar...@ish.com.au>
Subject Re: toMany relationship not fetched
Date Wed, 26 Apr 2006 02:47:46 GMT
Hello !

I'm still trying to fix committing problem I have. I think that is it  
something in my code, but I cant find out what. Can someone suggest  
what can be wrong ?

I have two related objects in context, one is new, and one is hollow  
(because it was copied to this context using localObject() ):

2006-04-26 12:05:46,172 [AWT-EventQueue-0] INFO   
com.ish.angel.controller.EditController  - attempting to commit,  
listing all objects in context:
2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
com.ish.angel.controller.EditController  - 1  
object :<com.ish.angel.cayenne.SubCategory@15880424,  
id=<ObjectId:SubCategory, TEMP:000000F1D0423EC5>, state=new,  
context=org.objectstyle.cayenne.CayenneContext@aaa10>
2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
com.ish.angel.controller.EditController  - 2  
object :<com.ish.angel.cayenne.Category@10349001,  
id=<ObjectId:Category, id=200>, state=hollow,  
context=org.objectstyle.cayenne.CayenneContext@aaa10>

commitChanges() throws an exception:

org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev-2006-4-25  
April 25 2006] Remote error. URL - http://localhost:8181/angel-server- 
cayenne
         at  
org.objectstyle.cayenne.remote.hessian.HessianConnection.doSendMessage 
(HessianConnection.java:181)
         at org.objectstyle.cayenne.remote.BaseConnection.sendMessage 
(BaseConnection.java:109)
         at org.objectstyle.cayenne.remote.ClientChannel.send 
(ClientChannel.java:279)
         at org.objectstyle.cayenne.remote.ClientChannel.onSync 
(ClientChannel.java:188)
         at org.objectstyle.cayenne.CayenneContext.doCommitChanges 
(CayenneContext.java:233)
         at org.objectstyle.cayenne.CayenneContext.commitChanges 
(CayenneContext.java:220)
         at com.ish.angel.controller.EditController.saveRecord 
(EditController.java:287)

on server side there is an exception thrown too:

2006-04-26 12:05:46,240 [SocketListener0-1] DEBUG  
com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
persistence state for class com.ish.angel.server.cayenne.SubCategory  
from: transient to: new
Apr 26, 2006 12:05:46 PM com.caucho.hessian.server.HessianSkeleton  
invoke
WARNING: java.lang.NullPointerException
java.lang.NullPointerException
         at org.objectstyle.cayenne.map.EntityResolver.lookupObjEntity 
(EntityResolver.java:514)
2006-04-26 12:05:46,640 [SocketListener0-1] DEBUG  
com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
persistence state for class com.ish.angel.server.cayenne.SubCategory  
from: transient to: transient
         at org.objectstyle.cayenne.access.ChildDiffLoader.arcCreated 
(ChildDiffLoader.java:141)
         at org.objectstyle.cayenne.graph.ArcCreateOperation.apply 
(ArcCreateOperation.java:80)
         at org.objectstyle.cayenne.graph.CompoundDiff.apply 
(CompoundDiff.java:133)
         at org.objectstyle.cayenne.access.DataContext.onContextFlush 
(DataContext.java:1171)
         at  
org.objectstyle.cayenne.access.ClientServerChannel.onCommit 
(ClientServerChannel.java:195)
         at org.objectstyle.cayenne.access.ClientServerChannel.onSync 
(ClientServerChannel.java:147)
         at  
org.objectstyle.cayenne.remote.service.DispatchHelper.dispatch 
(DispatchHelper.java:80)
         at  
org.objectstyle.cayenne.remote.service.BaseRemoteService.processMessage( 
BaseRemoteService.java:182)
         at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.caucho.hessian.server.HessianSkeleton.invoke 
(HessianSkeleton.java:157)
         at  
org.objectstyle.cayenne.remote.hessian.service._HessianServlet.service 
(_HessianServlet.java:388)
         at com.ish.angel.server.CayenneServlet.service 
(CayenneServlet.java:59)
         at org.mortbay.jetty.servlet.ServletHolder.handle 
(ServletHolder.java:428)
         at org.mortbay.jetty.servlet.ServletHandler.dispatch 
(ServletHandler.java:666)
         at org.mortbay.jetty.servlet.ServletHandler.handle 
(ServletHandler.java:568)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
         at org.mortbay.http.HttpServer.service(HttpServer.java:909)
         at org.mortbay.http.HttpConnection.service 
(HttpConnection.java:816)
         at org.mortbay.http.HttpConnection.handleNext 
(HttpConnection.java:982)
         at org.mortbay.http.HttpConnection.handle 
(HttpConnection.java:833)
         at org.mortbay.http.SocketListener.handleConnection 
(SocketListener.java:244)
         at org.mortbay.util.ThreadedServer.handle 
(ThreadedServer.java:357)
         at org.mortbay.util.ThreadPool$PoolThread.run 
(ThreadPool.java:534)

I followed the stack trace. There is a call to

         DataObject source = findObject(nodeId);

	which calls :
	
	graphManager.getNode(nodeId);

in  ChildDiffLoader. In my case it appears to return null. (I cant  
access cvs to put more logging into it to be 100% sure). Why getNode 
() returns null ? Could that be because ObjectId has already changed  
from TEMP id to permanent id ? (nodeId is actually ObjectId, isn't it ?)

Andrus, can you explain how is creating new object on server  
processed ? I can see that after committing a new record on server  
side this object is in transient state, and then it is inserted to  
some context (transient -> new). Is that caused by the exception that  
my object is then still in transient state ?

Thank you
Marcin


-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001



Mime
View raw message