Hello
We found a workaround for the second problem.
On 26/04/2006, at 5:12 PM, Marcin Skladaniec wrote:
Hi !
I found small temporary solution to my problem.
(I forgot to mention that we are using nightly build from 25.IV )
On 26/04/2006, at 2:55 PM, Marcin Skladaniec wrote:
Andrus
You mentioned once :
BTW, I noticed one minor thing in the mapping - you should not
populate "Client Superclass" field. This field is for the "wedge"
class that may optionally be inserted in the inheritance
hierarchy between cayenne.Persistent and _MyObject.
We are using "wedge" classes for both client and server (that is
between _clientEntity and PersistentObject, and as well between
_serverEntity and CayenneDataObject. Is it all right ?
I have another problem which might be related. This is a short
description:
Student someStudent =
...
Student student = context.localObject(someStudent, null) ;
logger.info( student.getLanguage() );
prints :
<[EMAIL PROTECTED], id=<ObjectId:Language,
id=1648>, state=committed,
[EMAIL PROTECTED]>
which is correct. But the problem is that
logger.info( "Number of students speaking "+student.getLanguage
().getName() +" language : "+student.getLanguage().getStudents
().size() );
prints:
Number of students speaking null language : 2
So the language record is not correct. It looks like the "simple"
value (name) is missing while the related value (students) is
correct !
There is no exception thrown. Could having the "wedge" class cause
object to be not serialized properly ? Could it cause the problem
which I described before in this thread ?
It looks like the Language object is in HOLLOW state but does not
know about it. So we forced the state of Language to HOLLOW and
everything works fine. Is there any way for related object to be in a
wrong state because of localObject ?
I just explain that the "wedge" classes are important to us, on
client side we are using them as a simple triggers (to have simple
validation happen before anything goes to server), we have
getValueForKey / setValueForKey / getDataTypeForKey methods
(implemented in dotemplates).
Having to remove those classes from project is not impossible, but
would require some hard work. Please advise us if using those
classes is right, or if you rather not recommend using them. Thank
you !
Marcin
On 26/04/2006, at 12:47 PM, Marcin Skladaniec wrote:
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 :<[EMAIL PROTECTED],
id=<ObjectId:SubCategory, TEMP:000000F1D0423EC5>, state=new,
[EMAIL PROTECTED]>
2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO
com.ish.angel.controller.EditController - 2
object :<[EMAIL PROTECTED],
id=<ObjectId:Category, id=200>, state=hollow,
[EMAIL PROTECTED]>
Here the one of the object is hollow - thats because it is just
recently localObject() was called on it. This causes the problem
with committing. It looks like after accessing any of the fields
with getters and changing persistence state to commited there is no
problem with commiting whole context.
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.doSendMessa
ge(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.processMess
age(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.servi
ce(_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
-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001