Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:14 Go to next message
Richard Meyer is currently offline Richard MeyerFriend
Messages: 40
Registered: June 2012
Member
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 11:22 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6683
Registered: July 2009
Senior Member
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 14:37 Go to previous messageGo to next message
Richard Meyer is currently offline Richard MeyerFriend
Messages: 40
Registered: June 2012
Member
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 12:07 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6683
Registered: July 2009
Senior Member
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: Wed May 08 13:50:30 GMT 2024

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

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

Back to the top