Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Opposite and many to many
Opposite and many to many [message #1237393] Wed, 29 January 2014 15:48 Go to next message
eclipse user is currently offline eclipse userFriend
Messages: 3
Registered: July 2013
Junior Member
Hello guys,
i'm using EMF and i've got the following weir behavior, maybe you might
help me.


I have 2 opposites features many-to-many in on of my EClass.

here is the ecore definition of my features:

<eStructuralFeatures xsi:type="ecore:EReference" name="parent"
upperBound="-1"
eType="#//DataSet" resolveProxies="false"
eOpposite="#//DataSet/child"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="child"
upperBound="-1"
eType="#//DataSet" resolveProxies="false"
eOpposite="#//DataSet/parent"/>


The features are both unique to avoid duplications whithin my collections.
When i save my model the first everything works fine, but when i load
it, i when the XMLLoader add an object in the feature parent, it also
add the object in the child feature but it does not check the content,
so after the model is loaded i have multiple times the same objects in
both the list.

The only way to avoid this behavior was for me to make my parent feature
transcient.

Is this behavior(having multiple time the same objects in the features
collections) expected ? And is there another way to prevent this to happen?

Thanx.
Ludovic
Re: Opposite and many to many [message #1240948 is a reply to message #1237393] Fri, 07 February 2014 09:01 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ludovic,

Comments below.

On 29/01/2014 4:48 PM, lca wrote:
> Hello guys,
> i'm using EMF and i've got the following weir behavior, maybe you
> might help me.
>
>
> I have 2 opposites features many-to-many in on of my EClass.
>
> here is the ecore definition of my features:
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="parent"
> upperBound="-1"
> eType="#//DataSet" resolveProxies="false"
> eOpposite="#//DataSet/child"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="child"
> upperBound="-1"
> eType="#//DataSet" resolveProxies="false"
> eOpposite="#//DataSet/parent"/>
>
>
> The features are both unique to avoid duplications whithin my
> collections.
> When i save my model the first everything works fine, but when i load
> it, i when the XMLLoader add an object in the feature parent, it also
> add the object in the child feature but it does not check the content,
> so after the model is loaded i have multiple times the same objects in
> both the list.
>
> The only way to avoid this behavior was for me to make my parent
> feature transcient.
>
> Is this behavior(having multiple time the same objects in the features
> collections) expected ? And is there another way to prevent this to
> happen?
The scenario you describe should be handled okay as is. You might try
using OPTION_DEFER_IDREF_RESOLUTION to see if that eliminates the problem.

>
> Thanx.
> Ludovic


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Resolve platform:/resources outside the platform
Next Topic:EMF reference management
Goto Forum:
  


Current Time: Thu Mar 28 18:38:13 GMT 2024

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

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

Back to the top