Skip to main content



      Home
Home » Modeling » EMF » Opposite references not serialized if not in the current resource ?
Opposite references not serialized if not in the current resource ? [message #389566] Sat, 27 November 2004 14:04 Go to next message
Eclipse UserFriend
Hello,

Not sure if it is a bug, or works as documented... somewhere.

I have a class that acts as a container for a set of references with an opposite
relation.

interface Model {
/**
* @model opposite="models" containment="false"
*/
Category getCategory();
}

interface Category {
/**
* @model type="Model" container="false" opposite="category"
*/
List getModels();
}

With this model, i can create some Model and Category and each time a category
is associated with a model, its model list is correctly updated.

If i split my resources so that the allowed categories lies in their own
resource, i can load the resource in a model definition, and associate its category.

But, one the model is saved, this information is stored in the model resource
but the category resource has not been updated.

How to make this work?
(Using Eclipse 3.1, EMF 2.1)
--
Christophe Avare
Re: Opposite references not serialized if not in the current resource ? [message #389579 is a reply to message #389566] Mon, 29 November 2004 07:17 Go to previous messageGo to next message
Eclipse UserFriend
Christophe,

If you look in the doSave of the generated editor, you'll see that it
only saves the first resource in the resource set. You can change this
to save them all. We can also consider generalizing the generated
editor to handle this type of situation better (if you open a bugzilla
feature request).


Christophe Avare wrote:

> Hello,
>
> Not sure if it is a bug, or works as documented... somewhere.
>
> I have a class that acts as a container for a set of references with
> an opposite relation.
>
> interface Model {
> /**
> * @model opposite="models" containment="false"
> */
> Category getCategory();
> }
>
> interface Category {
> /**
> * @model type="Model" container="false" opposite="category"
> */
> List getModels();
> }
>
> With this model, i can create some Model and Category and each time a
> category is associated with a model, its model list is correctly updated.
>
> If i split my resources so that the allowed categories lies in their
> own resource, i can load the resource in a model definition, and
> associate its category.
>
> But, one the model is saved, this information is stored in the model
> resource but the category resource has not been updated.
>
> How to make this work?
> (Using Eclipse 3.1, EMF 2.1)
> --
> Christophe Avare
Re: Opposite references not serialized if not in the current resource ? [message #389596 is a reply to message #389579] Mon, 29 November 2004 15:09 Go to previous message
Eclipse UserFriend
Thanks Ed,

It's a good starting point for me to understand the template system.

Ed Merks a écrit :
> Christophe,
>
> If you look in the doSave of the generated editor, you'll see that it
> only saves the first resource in the resource set. You can change this
> to save them all. We can also consider generalizing the generated
> editor to handle this type of situation better (if you open a bugzilla
> feature request).
>
Previous Topic:Appropriate use of annotations
Next Topic:Generating Java Classes using JET
Goto Forum:
  


Current Time: Mon Sep 15 08:05:34 EDT 2025

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

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

Back to the top