Skip to main content



      Home
Home » Modeling » EMF » [CDO] efficient removing objects from lazy loaded model
[CDO] efficient removing objects from lazy loaded model [message #909581] Fri, 07 September 2012 07:14 Go to next message
Eclipse UserFriend
Hy,

Is there a smart way to delete objects (and all his references) in a lazy loaded model?
If I execute the following code the whole model will be loaded.
EcoreUtil.delete(myObject);


Thanks for any advice

Re: [CDO] efficient removing objects from lazy loaded model [message #909587 is a reply to message #909581] Fri, 07 September 2012 07:22 Go to previous messageGo to next message
Eclipse UserFriend
Am 07.09.2012 13:14, schrieb Richard Meyer:
> Hy,
>
> Is there a smart way to delete objects (and all his references) in a lazy loaded model?
If you want to avoid to traverse the entire object graph locally you should use remote queries.
CDOView provides convenient API for this task:

org.eclipse.emf.cdo.view.CDOView.queryXRefs(CDOObject, EReference...)
org.eclipse.emf.cdo.view.CDOView.queryXRefs(Set<CDOObject>, EReference...)
org.eclipse.emf.cdo.view.CDOView.queryXRefsAsync(Set<CDOObject>, EReference...)

You may have to query multiple times.

> If I execute the following code the whole model will be loaded.
>
> EcoreUtil.delete(myObject);
Yes, that one doesn't scale well.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] efficient removing objects from lazy loaded model [message #909670 is a reply to message #909581] Fri, 07 September 2012 10:37 Go to previous messageGo to next message
Eclipse UserFriend
Hy Eike,

Thanks for your response.
This works, but If I delete a complete branch (in my model), I have to check each leaf if it has a reference to an object outside the branch (to remove them).

What would be the "normal way" to delete objects in lazy loaded CDO models?

Thanks for any advice
Re: [CDO] efficient removing objects from lazy loaded model [message #911331 is a reply to message #909670] Tue, 11 September 2012 08:07 Go to previous message
Eclipse UserFriend
Am 07.09.2012 16:37, schrieb Richard Meyer:
> Hy Eike,
>
> Thanks for your response.
> This works, but If I delete a complete branch (in my model), I have to check each leaf if it has a reference to an
> object outside the branch (to remove them).
> What would be the "normal way" to delete objects in lazy loaded CDO models?
Sorry for the late answer. There is currently no mechanism in CDO that directly supports deleting all transitive
incoming cross-references. You may have to query multiple times.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Previous Topic:[CDO] Deadlock/Memory leak on multiple concurrent transactions?
Next Topic:[CDO] CDOResources being EObjects confuses some APIs
Goto Forum:
  


Current Time: Thu Nov 06 20:18:11 EST 2025

Powered by FUDForum. Page generated in 0.06035 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top