Hello
I think someone already asked about that, but I cant find this post.
I have a problem with removing objects from context. I tried :
CayenneContext context = new CayenneContext(channel, true, true);
CSite site = (CSite) context.newObject(CSite.class);
context.getGraphManager().unregisterNode(site);
but the object is still in the context (it is still in getContext
().uncommittedObjects() list ).
if I do
CayenneContext context = new CayenneContext(channel, true, true);
CSite site = (CSite) context.newObject(CSite.class);
context.deleteObject(site);
there is a null object in context, so I feel like I'm hitting some
bug. I started to browse code (Its good to have access to repository
again !).
I have noticed that in ObjectContextDeleteAction there is a deleteNew
method which makes a call to
context.getGraphManager().unregisterNode(object.getObjectId());
so I followed it futher to GraphMap and CayenneContextGraphManager
and I realized that the latter does not pay attention to
unregisterNode(), and therefore stateLog which keeps dirtyIds is not
updated.
I have no time to look further into this problem, but I believe that
overwriting unregisterNode() in CayenneContextGraphManager with
something like that should work.
public synchronized Object unregisterNode(Object nodeId) {
Object o = super.unregisterNode(nodeId);
stateLog.nodeRemoved(o);
return o;
}
But I feel like it is a ugly solution, and maybe there is no
notification created and this is causing stateLog to keep the old
values ? I don't understand this part well...
I believe that this problem will be a 5 minute task for Andrus, so
I'm not creating a JIRA task.
Regards
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
This archive was generated by hypermail 2.0.0 : Tue May 09 2006 - 22:54:05 EDT