Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo]E_CONTAINER_FEATUREID maintenance after model changing
[Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427833] Mon, 02 March 2009 16:33 Go to next message
koloale is currently offline koloaleFriend
Messages: 41
Registered: July 2009
Member
Hello, newsgroup.
I don't completely understand values that are saved in DB in column
maintenance (they have negative values -1, -10 etc, but feature IDs in a
Package class have positive values). After adding some feature or class
in my model feature IDs also have changed. So I guess I need to change
somehow corresponding values in DB as well, Please, explain what values
are in E_CONTAINER_FEATUREID column and how I should keep my DB in the
consistent state after ecore model update? May be I need to add feature
at the end only, but there is a problem with inheritance also.

Many thanks in advance,
Alexey
Re: [Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427838 is a reply to message #427833] Mon, 02 March 2009 18:49 Go to previous messageGo to next message
koloale is currently offline koloaleFriend
Messages: 41
Registered: July 2009
Member
For example if I add feature to the base class, than all feature id in
subclasses shift by 1 and there is no way to change subclasses feature
id due to magic freeze method. So in db all E_CONTAINER_FEATUREID should
be increased by 1, right? Is there any way to proceed working with DB
without manually updating all rows?

Alexey.
Re: [Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427846 is a reply to message #427838] Mon, 02 March 2009 20:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090107080405080108070903
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Alexey,

For InternalEObject it says:

/**
* The base value for negative, i.e., opposite-end,
eContainerFeatureID values.
*/
static final int EOPPOSITE_FEATURE_BASE = -1;

/**
* Returns the container feature ID.
* If the container isn't a navigable feature, this will be a
negative ID indicating the inverse of the containment feature's ID.
* @return the container feature ID.
* @see #eContainmentFeature()
* @see #EOPPOSITE_FEATURE_BASE
*/
int eContainerFeatureID();

So the ID is either >= 0 when its a container feature of the object,
i.e., if the containment reference of the container is explicitly
bidirectional, or < 0 when it's the container object's feature for ID
(EOPPOSITE_FEATURE_BASE - value). Generally you need to add features to
the end and only to leaf classes not to shift feature IDs.

koloale wrote:
> For example if I add feature to the base class, than all feature id in
> subclasses shift by 1 and there is no way to change subclasses feature
> id due to magic freeze method. So in db all E_CONTAINER_FEATUREID
> should be increased by 1, right? Is there any way to proceed working
> with DB without manually updating all rows?
>
> Alexey.
>

--------------090107080405080108070903
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Alexey,<br>
<br>
For InternalEObject it says:<br>
<blockquote>  /**<br>
   * The base value for negative, i.e., opposite-end,
eContainerFeatureID values.<br>
   */<br>
  static final int EOPPOSITE_FEATURE_BASE = -1;<br>
<br>
  /**<br>
   * Returns the container feature ID.<br>
   * If the container isn't a navigable feature, this will be a
negative ID indicating the inverse of the containment feature's ID.<br>
   * @return the container feature ID.<br>
   * @see #eContainmentFeature()<br>
   * @see #EOPPOSITE_FEATURE_BASE<br>
   */<br>
  int eContainerFeatureID();<br>
</blockquote>
So the ID is either &gt;= 0 when its a container feature of the object,
i.e., if the containment reference of the container is explicitly
bidirectional, or &lt; 0 when it's the container object's feature for
ID (EOPPOSITE_FEATURE_BASE - value).  Generally you need to add
features to the end and only to leaf classes not to shift feature IDs.<br>
<br>
koloale wrote:
<blockquote cite="mid:goh9nb$ol4$1@build.eclipse.org" type="cite">For
example if I add feature to the base class, than all feature id in
subclasses shift by 1 and there is no way to change subclasses feature
id due to magic freeze method. So in db all E_CONTAINER_FEATUREID
should be increased by 1, right? Is there any way to proceed working
with DB without manually updating all rows?
<br>
<br>
Alexey.
<br>
<br>
</blockquote>
</body>
</html>

--------------090107080405080108070903--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427863 is a reply to message #427846] Tue, 03 March 2009 07:59 Go to previous messageGo to next message
koloale is currently offline koloaleFriend
Messages: 41
Registered: July 2009
Member
So I can't add a new feature to a base class? But it is very
inconvenient and prevents superclasses for extension. Is it designed
restriction?

Ed Merks wrote:
> Alexey,
>
> For InternalEObject it says:
>
> /**
> * The base value for negative, i.e., opposite-end,
> eContainerFeatureID values.
> */
> static final int EOPPOSITE_FEATURE_BASE = -1;
>
> /**
> * Returns the container feature ID.
> * If the container isn't a navigable feature, this will be a
> negative ID indicating the inverse of the containment feature's ID.
> * @return the container feature ID.
> * @see #eContainmentFeature()
> * @see #EOPPOSITE_FEATURE_BASE
> */
> int eContainerFeatureID();
>
> So the ID is either >= 0 when its a container feature of the object,
> i.e., if the containment reference of the container is explicitly
> bidirectional, or < 0 when it's the container object's feature for ID
> (EOPPOSITE_FEATURE_BASE - value). Generally you need to add features to
> the end and only to leaf classes not to shift feature IDs.
>
Re: [Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427866 is a reply to message #427863] Tue, 03 March 2009 08:33 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Alexey,
On the short term (weeks) I am afraid that you need to update the econtainerfeatureid manually. Please enter a bugzilla
for a better solution. I think that I can make it so that the featureid is replaced by the featurename. I can make this
work transparently so that it will support a mix of featureid and featurename values in the db column. To support
current as well as new situations.
Then if you want to change the model while your db still contains featureids, the next thing is to write a small program
which runs through all tables and replaces the featureid with featurename. We can discuss how to do this in the bugzilla.

gr. Martin

koloale wrote:
> So I can't add a new feature to a base class? But it is very
> inconvenient and prevents superclasses for extension. Is it designed
> restriction?
>
> Ed Merks wrote:
>> Alexey,
>>
>> For InternalEObject it says:
>>
>> /**
>> * The base value for negative, i.e., opposite-end,
>> eContainerFeatureID values.
>> */
>> static final int EOPPOSITE_FEATURE_BASE = -1;
>>
>> /**
>> * Returns the container feature ID.
>> * If the container isn't a navigable feature, this will be a
>> negative ID indicating the inverse of the containment feature's ID.
>> * @return the container feature ID.
>> * @see #eContainmentFeature()
>> * @see #EOPPOSITE_FEATURE_BASE
>> */
>> int eContainerFeatureID();
>>
>> So the ID is either >= 0 when its a container feature of the object,
>> i.e., if the containment reference of the container is explicitly
>> bidirectional, or < 0 when it's the container object's feature for ID
>> (EOPPOSITE_FEATURE_BASE - value). Generally you need to add features
>> to the end and only to leaf classes not to shift feature IDs.
>>


--

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: [Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427875 is a reply to message #427866] Tue, 03 March 2009 12:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Martin,

Yes, I was going to suggest that these feature IDs are nice to use
dynamically at runtime, but they are not an appropriate long term
persistence mechanism. The combination of package nsURI, class name,
and feature name are far more appropriate, and of course if the first
two are implicit, then just the name will do. Probably it makes sense
to always use the name of the containment feature of the container...


Martin Taal wrote:
> Hi Alexey,
> On the short term (weeks) I am afraid that you need to update the
> econtainerfeatureid manually. Please enter a bugzilla for a better
> solution. I think that I can make it so that the featureid is replaced
> by the featurename. I can make this work transparently so that it will
> support a mix of featureid and featurename values in the db column. To
> support current as well as new situations.
> Then if you want to change the model while your db still contains
> featureids, the next thing is to write a small program which runs
> through all tables and replaces the featureid with featurename. We can
> discuss how to do this in the bugzilla.
>
> gr. Martin
>
> koloale wrote:
>> So I can't add a new feature to a base class? But it is very
>> inconvenient and prevents superclasses for extension. Is it designed
>> restriction?
>>
>> Ed Merks wrote:
>>> Alexey,
>>>
>>> For InternalEObject it says:
>>>
>>> /**
>>> * The base value for negative, i.e., opposite-end,
>>> eContainerFeatureID values.
>>> */
>>> static final int EOPPOSITE_FEATURE_BASE = -1;
>>>
>>> /**
>>> * Returns the container feature ID.
>>> * If the container isn't a navigable feature, this will be a
>>> negative ID indicating the inverse of the containment feature's ID.
>>> * @return the container feature ID.
>>> * @see #eContainmentFeature()
>>> * @see #EOPPOSITE_FEATURE_BASE
>>> */
>>> int eContainerFeatureID();
>>>
>>> So the ID is either >= 0 when its a container feature of the object,
>>> i.e., if the containment reference of the container is explicitly
>>> bidirectional, or < 0 when it's the container object's feature for
>>> ID (EOPPOSITE_FEATURE_BASE - value). Generally you need to add
>>> features to the end and only to leaf classes not to shift feature IDs.
>>>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Advise on transferring large set of data
Next Topic:Serialization of references
Goto Forum:
  


Current Time: Fri Apr 19 06:38:55 GMT 2024

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

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

Back to the top