Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [TEXO] Containment references
| | |
Re: [TEXO] Containment references [message #690379 is a reply to message #690163] |
Wed, 29 June 2011 12:48 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Peter,
This is some work to get done by overriding and not soo easy by overriding the templates I think. Let's discuss a bit
further, a distinction can be made between 2 cases:
- there is always only type of container, the eContainer property can have a specific type (so not Object), this is easy
to map also in the generated orm
- there are can be multiple types of containers (at runtime an object only has one container, but different objects can
have different containers of different types), the eContainer will be of type Object, this is more difficult to map in a
orm.xml, or a solution is to generate a different eContainer property for each type of parent
Does the second possibility apply to your case (multiple types of parents)?
gr. Martin
On 06/29/2011 07:18 AM, Peter Kullmann wrote:
> Hi Martin
>
> Correct. I have just the reference with the containment-bit set.
>
> Regards,
> Peter
>
> Am 28.06.11 12:02, schrieb Martin Taal:
>> Hi Peter,
>> Texo has an option to generate bidirectional-safe code which
>> automatically updates the other side of the association. But in this
>> case you mean the implicit eContainer association (so there is no
>> explicit efeature which models the association to the container), right?
>>
>> gr. Martin
>>
>> On 06/27/2011 06:05 PM, Peter Kullmann wrote:
>>> Hi, I've seen that texo does not generate code for containment
>>> references (ie there is no eContainer property). But I
>>> would like to have it for some entities. How can this be done?
>>>
>>> Thanks
>>> Peter
>>
>>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [TEXO] Containment references [message #690460 is a reply to message #690379] |
Wed, 29 June 2011 14:38 |
Peter Kullmann Messages: 240 Registered: July 2009 |
Senior Member |
|
|
Hi Martin,
I have only the simple case in my application. One of the containments
is actually the famous Order -> Oderline relation. I would like to have
a Orderline.getOrder() method. That's all.
Regards,
Peter
Am 29.06.11 14:48, schrieb Martin Taal:
> Hi Peter,
> This is some work to get done by overriding and not soo easy by
> overriding the templates I think. Let's discuss a bit further, a
> distinction can be made between 2 cases:
> - there is always only type of container, the eContainer property can
> have a specific type (so not Object), this is easy to map also in the
> generated orm
> - there are can be multiple types of containers (at runtime an object
> only has one container, but different objects can have different
> containers of different types), the eContainer will be of type Object,
> this is more difficult to map in a orm.xml, or a solution is to generate
> a different eContainer property for each type of parent
>
> Does the second possibility apply to your case (multiple types of parents)?
>
> gr. Martin
>
> On 06/29/2011 07:18 AM, Peter Kullmann wrote:
>> Hi Martin
>>
>> Correct. I have just the reference with the containment-bit set.
>>
>> Regards,
>> Peter
>>
>> Am 28.06.11 12:02, schrieb Martin Taal:
>>> Hi Peter,
>>> Texo has an option to generate bidirectional-safe code which
>>> automatically updates the other side of the association. But in this
>>> case you mean the implicit eContainer association (so there is no
>>> explicit efeature which models the association to the container), right?
>>>
>>> gr. Martin
>>>
>>> On 06/27/2011 06:05 PM, Peter Kullmann wrote:
>>>> Hi, I've seen that texo does not generate code for containment
>>>> references (ie there is no eContainer property). But I
>>>> would like to have it for some entities. How can this be done?
>>>>
>>>> Thanks
>>>> Peter
>>>
>>>
>>
>
>
|
|
|
Re: [TEXO] Containment references [message #690847 is a reply to message #690460] |
Thu, 30 June 2011 09:46 |
Peter Kullmann Messages: 240 Registered: July 2009 |
Senior Member |
|
|
Oh, now I got it: I just defined an opposite relation to my existing
containment. With this everything works as expected. (I was under the
misconception that containment references must not have opposites).
Thanks
Peter
Am 29.06.11 16:38, schrieb Peter Kullmann:
> Hi Martin,
> I have only the simple case in my application. One of the containments
> is actually the famous Order -> Oderline relation. I would like to have
> a Orderline.getOrder() method. That's all.
> Regards,
> Peter
>
> Am 29.06.11 14:48, schrieb Martin Taal:
>> Hi Peter,
>> This is some work to get done by overriding and not soo easy by
>> overriding the templates I think. Let's discuss a bit further, a
>> distinction can be made between 2 cases:
>> - there is always only type of container, the eContainer property can
>> have a specific type (so not Object), this is easy to map also in the
>> generated orm
>> - there are can be multiple types of containers (at runtime an object
>> only has one container, but different objects can have different
>> containers of different types), the eContainer will be of type Object,
>> this is more difficult to map in a orm.xml, or a solution is to generate
>> a different eContainer property for each type of parent
>>
>> Does the second possibility apply to your case (multiple types of
>> parents)?
>>
>> gr. Martin
>>
>> On 06/29/2011 07:18 AM, Peter Kullmann wrote:
>>> Hi Martin
>>>
>>> Correct. I have just the reference with the containment-bit set.
>>>
>>> Regards,
>>> Peter
>>>
>>> Am 28.06.11 12:02, schrieb Martin Taal:
>>>> Hi Peter,
>>>> Texo has an option to generate bidirectional-safe code which
>>>> automatically updates the other side of the association. But in this
>>>> case you mean the implicit eContainer association (so there is no
>>>> explicit efeature which models the association to the container),
>>>> right?
>>>>
>>>> gr. Martin
>>>>
>>>> On 06/27/2011 06:05 PM, Peter Kullmann wrote:
>>>>> Hi, I've seen that texo does not generate code for containment
>>>>> references (ie there is no eContainer property). But I
>>>>> would like to have it for some entities. How can this be done?
>>>>>
>>>>> Thanks
>>>>> Peter
>>>>
>>>>
>>>
>>
>>
>
|
|
|
Re: [TEXO] Containment references [message #690848 is a reply to message #690847] |
Thu, 30 June 2011 10:08 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Peter,
Indeed they can have opposites. You can also add safe-bi-directional support to the code so that when changing one side
of the association that the other side is automatically updated, see here:
http://wiki.eclipse.org/Texo/Code_Generation_Details#EPackage_Model_Gen_Features
and then the Generate bi-directional association support property. This property can be set on EPackage and EReference
level.
gr. Martin
On 06/30/2011 11:46 AM, Peter Kullmann wrote:
> Oh, now I got it: I just defined an opposite relation to my existing containment. With this everything works as
> expected. (I was under the misconception that containment references must not have opposites).
> Thanks
> Peter
>
> Am 29.06.11 16:38, schrieb Peter Kullmann:
>> Hi Martin,
>> I have only the simple case in my application. One of the containments
>> is actually the famous Order -> Oderline relation. I would like to have
>> a Orderline.getOrder() method. That's all.
>> Regards,
>> Peter
>>
>> Am 29.06.11 14:48, schrieb Martin Taal:
>>> Hi Peter,
>>> This is some work to get done by overriding and not soo easy by
>>> overriding the templates I think. Let's discuss a bit further, a
>>> distinction can be made between 2 cases:
>>> - there is always only type of container, the eContainer property can
>>> have a specific type (so not Object), this is easy to map also in the
>>> generated orm
>>> - there are can be multiple types of containers (at runtime an object
>>> only has one container, but different objects can have different
>>> containers of different types), the eContainer will be of type Object,
>>> this is more difficult to map in a orm.xml, or a solution is to generate
>>> a different eContainer property for each type of parent
>>>
>>> Does the second possibility apply to your case (multiple types of
>>> parents)?
>>>
>>> gr. Martin
>>>
>>> On 06/29/2011 07:18 AM, Peter Kullmann wrote:
>>>> Hi Martin
>>>>
>>>> Correct. I have just the reference with the containment-bit set.
>>>>
>>>> Regards,
>>>> Peter
>>>>
>>>> Am 28.06.11 12:02, schrieb Martin Taal:
>>>>> Hi Peter,
>>>>> Texo has an option to generate bidirectional-safe code which
>>>>> automatically updates the other side of the association. But in this
>>>>> case you mean the implicit eContainer association (so there is no
>>>>> explicit efeature which models the association to the container),
>>>>> right?
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> On 06/27/2011 06:05 PM, Peter Kullmann wrote:
>>>>>> Hi, I've seen that texo does not generate code for containment
>>>>>> references (ie there is no eContainer property). But I
>>>>>> would like to have it for some entities. How can this be done?
>>>>>>
>>>>>> Thanks
>>>>>> Peter
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [TEXO] Containment references [message #690849 is a reply to message #690847] |
Thu, 30 June 2011 10:08 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Peter,
Indeed they can have opposites. You can also add safe-bi-directional support to the code so that when changing one side
of the association that the other side is automatically updated, see here:
http://wiki.eclipse.org/Texo/Code_Generation_Details#EPackage_Model_Gen_Features
and then the Generate bi-directional association support property. This property can be set on EPackage and EReference
level.
gr. Martin
On 06/30/2011 11:46 AM, Peter Kullmann wrote:
> Oh, now I got it: I just defined an opposite relation to my existing containment. With this everything works as
> expected. (I was under the misconception that containment references must not have opposites).
> Thanks
> Peter
>
> Am 29.06.11 16:38, schrieb Peter Kullmann:
>> Hi Martin,
>> I have only the simple case in my application. One of the containments
>> is actually the famous Order -> Oderline relation. I would like to have
>> a Orderline.getOrder() method. That's all.
>> Regards,
>> Peter
>>
>> Am 29.06.11 14:48, schrieb Martin Taal:
>>> Hi Peter,
>>> This is some work to get done by overriding and not soo easy by
>>> overriding the templates I think. Let's discuss a bit further, a
>>> distinction can be made between 2 cases:
>>> - there is always only type of container, the eContainer property can
>>> have a specific type (so not Object), this is easy to map also in the
>>> generated orm
>>> - there are can be multiple types of containers (at runtime an object
>>> only has one container, but different objects can have different
>>> containers of different types), the eContainer will be of type Object,
>>> this is more difficult to map in a orm.xml, or a solution is to generate
>>> a different eContainer property for each type of parent
>>>
>>> Does the second possibility apply to your case (multiple types of
>>> parents)?
>>>
>>> gr. Martin
>>>
>>> On 06/29/2011 07:18 AM, Peter Kullmann wrote:
>>>> Hi Martin
>>>>
>>>> Correct. I have just the reference with the containment-bit set.
>>>>
>>>> Regards,
>>>> Peter
>>>>
>>>> Am 28.06.11 12:02, schrieb Martin Taal:
>>>>> Hi Peter,
>>>>> Texo has an option to generate bidirectional-safe code which
>>>>> automatically updates the other side of the association. But in this
>>>>> case you mean the implicit eContainer association (so there is no
>>>>> explicit efeature which models the association to the container),
>>>>> right?
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> On 06/27/2011 06:05 PM, Peter Kullmann wrote:
>>>>>> Hi, I've seen that texo does not generate code for containment
>>>>>> references (ie there is no eContainer property). But I
>>>>>> would like to have it for some entities. How can this be done?
>>>>>>
>>>>>> Thanks
>>>>>> Peter
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Goto Forum:
Current Time: Tue Sep 24 18:31:58 GMT 2024
Powered by FUDForum. Page generated in 0.06188 seconds
|