Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Problems with inherited field
[Teneo] Problems with inherited field [message #92934] Fri, 10 August 2007 09:49 Go to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi all,

I'm always experiencing problem with Teneo.

I have models that are conformed to a meta model.

The problem is that when I try to deserialize the model from an ecore
file, if I register the meta models packages from the meta models loaded
from an ecore file it works fine and I can deserialize my model.

But when I try to get my meta model from Teneo (assuming that the meta
model getting from Teneo vas previously persisted by taking the meta
model coming from the ecore file), I obtain an Exception :

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
'val' not found. (file:///C:/eclipse-SDK-3.3-
win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
(XMLLoadImpl.java:81)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
(XMLLoadImpl.java:189)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
(XMLResourceImpl.java:180)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
(ResourceImpl.java:1354)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
(ResourceImpl.java:1155)
at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
'val' not found. (file:///C:/eclipse-SDK-3.3-
win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
(XMLHandler.java:1856)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
(XMLHandler.java:1820)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
(XMIHandler.java:149)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
(XMLHandler.java:2570)
at
org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
(SAXXMIHandler.java:76)

....



So, I have seen that the "val" feature that isn't found is an inherited
attribute. And If I remove all the inherited element from my model It
works.


I have also seen that the mapping generated by Teneo for a meta model
are not the same if the meta model come directly from my ecore file or
if it is a meta model persisted with Teneo.
With the same properties for the initialization of the hbdatastore
(inheritance mapping setted to SINGLE_TABLE), the subclasses are not
mapped in the same way :
- when the meta model come from the ecore file only one table is
created for a class hierarchy as it is say on
http://www.elver.org/hibernate/inheritance.html

- when the "same" meta model come from Teneo the mapping create
also tables for the subclasses.


It is a problem for me because I have to do a models and meta models
repository, so I must be able to add/get/remove models corresponding to
meta models that are stored in Teneo (without the ecore files containing
the metamodels). But here the meta models coming from file or coming
from Teneo appears to not being equivalent and it doesn't work...

I'm trying to solve it from a long time but I con't find the solution...


If anyone can help me, I will be very happy.



Thanks,


Guillaume Doux
Re: [Teneo] Problems with inherited field [message #92961 is a reply to message #92934] Fri, 10 August 2007 10:13 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Guillaume,
If you encounter many problems then (imho) the best approach I can think of is take a small model
and analyze the differences between the xml-serialization and the db-serialization (write the
db-serialized model to an xml file and do a text compare) and then post these differences here in
the newsgroup. I would use several small models each one of them covering a limited set of more
complex part of your real-live models (for example one covering inheritance, one other for several
associations, one for enumerates, one for edatatypes, etc.).

Regarding your specific problem, it seems that the inheritance relations between your eclasses is
not persisted in the database. Because of this:
- the sub eclasses are stored in their own table (as Teneo does not see a supertype)
- the inherited features are not visible in the subeclass (as the subeclass does not have a relation
anymore to its supertype).

Can you check/post the hibernate mapping for the eSuperType and eGenericSuperType feature of the eClass?

gr. Martin

guillaume wrote:
> Hi all,
>
> I'm always experiencing problem with Teneo.
>
> I have models that are conformed to a meta model.
>
> The problem is that when I try to deserialize the model from an ecore
> file, if I register the meta models packages from the meta models loaded
> from an ecore file it works fine and I can deserialize my model.
>
> But when I try to get my meta model from Teneo (assuming that the meta
> model getting from Teneo vas previously persisted by taking the meta
> model coming from the ecore file), I obtain an Exception :
>
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
> 'val' not found. (file:///C:/eclipse-SDK-3.3-
> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
> (XMLLoadImpl.java:81)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
> (XMLLoadImpl.java:189)
> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
> (XMLResourceImpl.java:180)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
> (ResourceImpl.java:1354)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
> (ResourceImpl.java:1155)
> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
> 'val' not found. (file:///C:/eclipse-SDK-3.3-
> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
> (XMLHandler.java:1856)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
> (XMLHandler.java:1820)
> at org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
> (XMIHandler.java:149)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
> (XMLHandler.java:2570)
> at
> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
> (SAXXMIHandler.java:76)
>
> ....
>
>
>
> So, I have seen that the "val" feature that isn't found is an inherited
> attribute. And If I remove all the inherited element from my model It
> works.
>
>
> I have also seen that the mapping generated by Teneo for a meta model
> are not the same if the meta model come directly from my ecore file or
> if it is a meta model persisted with Teneo.
> With the same properties for the initialization of the hbdatastore
> (inheritance mapping setted to SINGLE_TABLE), the subclasses are not
> mapped in the same way :
> - when the meta model come from the ecore file only one table is
> created for a class hierarchy as it is say on
> http://www.elver.org/hibernate/inheritance.html
>
> - when the "same" meta model come from Teneo the mapping create
> also tables for the subclasses.
>
>
> It is a problem for me because I have to do a models and meta models
> repository, so I must be able to add/get/remove models corresponding to
> meta models that are stored in Teneo (without the ecore files containing
> the metamodels). But here the meta models coming from file or coming
> from Teneo appears to not being equivalent and it doesn't work...
>
> I'm trying to solve it from a long time but I con't find the solution...
>
>
> If anyone can help me, I will be very happy.
>
>
>
> Thanks,
>
>
> Guillaume Doux
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] Problems with inherited field [message #93005 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi again,

I attach the generated mapping for the meta-model coming from the ecore
file (mappingWithModelFromEcoreFile.xml) , the mapping for the meta-model
coming from Teneo (mappingWithModelFromTeneo.xml) , the serialized version
of my meta-model coming from Teneo (debFromTeneo.ecore) and my original
meta-model file (debFile.ecore).

The difference between the 2 ecore file is that in my original meta model,
the subclasses are represented like this :
<eClassifiers xsi:type="ecore:EClass" name="Version"
eSuperTypes="#/1/Field"/>

and in the serialized form coming from Teneo, I have this :
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="ecore:EClass
testdeb.ecore#/1/Field"/>
</eClassifiers>


Thanks,


Guillaume




Martin Taal <mtaal@elver.org> wrote in
news:f9hdp5$kh2$1@build.eclipse.org:

> Hi Guillaume,
> If you encounter many problems then (imho) the best approach I can
> think of is take a small model and analyze the differences between the
> xml-serialization and the db-serialization (write the db-serialized
> model to an xml file and do a text compare) and then post these
> differences here in the newsgroup. I would use several small models
> each one of them covering a limited set of more complex part of your
> real-live models (for example one covering inheritance, one other for
> several associations, one for enumerates, one for edatatypes, etc.).
>
> Regarding your specific problem, it seems that the inheritance
> relations between your eclasses is not persisted in the database.
> Because of this: - the sub eclasses are stored in their own table (as
> Teneo does not see a supertype) - the inherited features are not
> visible in the subeclass (as the subeclass does not have a relation
> anymore to its supertype).
>
> Can you check/post the hibernate mapping for the eSuperType and
> eGenericSuperType feature of the eClass?
>
> gr. Martin
>
> guillaume wrote:
>> Hi all,
>>
>> I'm always experiencing problem with Teneo.
>>
>> I have models that are conformed to a meta model.
>>
>> The problem is that when I try to deserialize the model from an ecore
>> file, if I register the meta models packages from the meta models
>> loaded from an ecore file it works fine and I can deserialize my
>> model.
>>
>> But when I try to get my meta model from Teneo (assuming that the
>> meta model getting from Teneo vas previously persisted by taking the
>> meta model coming from the ecore file), I obtain an Exception :
>>
>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
>> 'val' not found. (file:///C:/eclipse-SDK-3.3-
>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
>> (XMLLoadImpl.java:81)
>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
>> (XMLLoadImpl.java:189)
>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
>> (XMLResourceImpl.java:180)
>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>> (ResourceImpl.java:1354)
>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>> (ResourceImpl.java:1155)
>> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException:
>> Feature 'val' not found. (file:///C:/eclipse-SDK-3.3-
>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
>> (XMLHandler.java:1856)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
>> (XMLHandler.java:1820)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
>> (XMIHandler.java:149)
>> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
>> (XMLHandler.java:2570)
>> at
>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
>> (SAXXMIHandler.java:76)
>>
>> ....
>>
>>
>>
>> So, I have seen that the "val" feature that isn't found is an
>> inherited attribute. And If I remove all the inherited element from
>> my model It works.
>>
>>
>> I have also seen that the mapping generated by Teneo for a meta model
>> are not the same if the meta model come directly from my ecore file
>> or if it is a meta model persisted with Teneo.
>> With the same properties for the initialization of the hbdatastore
>> (inheritance mapping setted to SINGLE_TABLE), the subclasses are not
>> mapped in the same way :
>> - when the meta model come from the ecore file only one
>> table is
>> created for a class hierarchy as it is say on
>> http://www.elver.org/hibernate/inheritance.html
>>
>> - when the "same" meta model come from Teneo the mapping
>> create
>> also tables for the subclasses.
>>
>>
>> It is a problem for me because I have to do a models and meta models
>> repository, so I must be able to add/get/remove models corresponding
>> to meta models that are stored in Teneo (without the ecore files
>> containing the metamodels). But here the meta models coming from file
>> or coming from Teneo appears to not being equivalent and it doesn't
>> work...
>>
>> I'm trying to solve it from a long time but I con't find the
>> solution...
>>
>>
>> If anyone can help me, I will be very happy.
>>
>>
>>
>> Thanks,
>>
>>
>> Guillaume Doux
>>
>>
>>
>
>
Re: [Teneo] Problems with inherited field - File 1 of 4 - debFile.ecore (1/1) [message #93020 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Re: [Teneo] Problems with inherited field - File 2 of 4 - debFromTeneo.ecore (1/1) [message #93034 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Re: [Teneo] Problems with inherited field - File 3 of 4 - mappingWithModelFromEcoreFile.xml (1/1) [message #93070 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Re: [Teneo] Problems with inherited field - File 4 of 4 - mappingWithModelFromTeneo.xml (1/1) [message #93085 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Re: [Teneo] Problems with inherited field [message #93101 is a reply to message #93005] Fri, 10 August 2007 11:22 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
and how does the hbm mapping of the ecore model itself look like? Especially the part around
EClassifier.

gr. Martin

guillaume wrote:
> Hi again,
>
> I attach the generated mapping for the meta-model coming from the ecore
> file (mappingWithModelFromEcoreFile.xml) , the mapping for the meta-model
> coming from Teneo (mappingWithModelFromTeneo.xml) , the serialized version
> of my meta-model coming from Teneo (debFromTeneo.ecore) and my original
> meta-model file (debFile.ecore).
>
> The difference between the 2 ecore file is that in my original meta model,
> the subclasses are represented like this :
> <eClassifiers xsi:type="ecore:EClass" name="Version"
> eSuperTypes="#/1/Field"/>
>
> and in the serialized form coming from Teneo, I have this :
> <eClassifiers xsi:type="ecore:EClass" name="Version">
> <eGenericSuperTypes eClassifier="ecore:EClass
> testdeb.ecore#/1/Field"/>
> </eClassifiers>
>
>
> Thanks,
>
>
> Guillaume
>
>
>
>
> Martin Taal <mtaal@elver.org> wrote in
> news:f9hdp5$kh2$1@build.eclipse.org:
>
>> Hi Guillaume,
>> If you encounter many problems then (imho) the best approach I can
>> think of is take a small model and analyze the differences between the
>> xml-serialization and the db-serialization (write the db-serialized
>> model to an xml file and do a text compare) and then post these
>> differences here in the newsgroup. I would use several small models
>> each one of them covering a limited set of more complex part of your
>> real-live models (for example one covering inheritance, one other for
>> several associations, one for enumerates, one for edatatypes, etc.).
>>
>> Regarding your specific problem, it seems that the inheritance
>> relations between your eclasses is not persisted in the database.
>> Because of this: - the sub eclasses are stored in their own table (as
>> Teneo does not see a supertype) - the inherited features are not
>> visible in the subeclass (as the subeclass does not have a relation
>> anymore to its supertype).
>>
>> Can you check/post the hibernate mapping for the eSuperType and
>> eGenericSuperType feature of the eClass?
>>
>> gr. Martin
>>
>> guillaume wrote:
>>> Hi all,
>>>
>>> I'm always experiencing problem with Teneo.
>>>
>>> I have models that are conformed to a meta model.
>>>
>>> The problem is that when I try to deserialize the model from an ecore
>>> file, if I register the meta models packages from the meta models
>>> loaded from an ecore file it works fine and I can deserialize my
>>> model.
>>>
>>> But when I try to get my meta model from Teneo (assuming that the
>>> meta model getting from Teneo vas previously persisted by taking the
>>> meta model coming from the ecore file), I obtain an Exception :
>>>
>>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
>>> 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
>>> (XMLLoadImpl.java:81)
>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
>>> (XMLLoadImpl.java:189)
>>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
>>> (XMLResourceImpl.java:180)
>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>> (ResourceImpl.java:1354)
>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>> (ResourceImpl.java:1155)
>>> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
>>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException:
>>> Feature 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
>>> (XMLHandler.java:1856)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
>>> (XMLHandler.java:1820)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
>>> (XMIHandler.java:149)
>>> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
>>> (XMLHandler.java:2570)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
>>> (SAXXMIHandler.java:76)
>>>
>>> ....
>>>
>>>
>>>
>>> So, I have seen that the "val" feature that isn't found is an
>>> inherited attribute. And If I remove all the inherited element from
>>> my model It works.
>>>
>>>
>>> I have also seen that the mapping generated by Teneo for a meta model
>>> are not the same if the meta model come directly from my ecore file
>>> or if it is a meta model persisted with Teneo.
>>> With the same properties for the initialization of the hbdatastore
>>> (inheritance mapping setted to SINGLE_TABLE), the subclasses are not
>>> mapped in the same way :
>>> - when the meta model come from the ecore file only one
>>> table is
>>> created for a class hierarchy as it is say on
>>> http://www.elver.org/hibernate/inheritance.html
>>>
>>> - when the "same" meta model come from Teneo the mapping
>>> create
>>> also tables for the subclasses.
>>>
>>>
>>> It is a problem for me because I have to do a models and meta models
>>> repository, so I must be able to add/get/remove models corresponding
>>> to meta models that are stored in Teneo (without the ecore files
>>> containing the metamodels). But here the meta models coming from file
>>> or coming from Teneo appears to not being equivalent and it doesn't
>>> work...
>>>
>>> I'm trying to solve it from a long time but I con't find the
>>> solution...
>>>
>>>
>>> If anyone can help me, I will be very happy.
>>>
>>>
>>>
>>> Thanks,
>>>
>>>
>>> Guillaume Doux
>>>
>>>
>>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] Problems with inherited field - 1 attachment [message #93131 is a reply to message #93101] Fri, 10 August 2007 12:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

It's the mapping corresponding to the EcorePackage,

the part arround the EClassifier is :


<subclass name="org.eclipse.emf.ecore.impl.EClassifierImpl" entity-
name="EClassifier" abstract="true" lazy="false" extends="ENamedElement"
discriminator-value="EClassifier">
<meta attribute="eclassName">EClassifier</meta>
<meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore
</meta>
<property name="instanceClassName" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false"
name="`instanceclassname`"/>
</property>
<property name="instanceTypeName" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false"
name="`instancetypename`"/>
</property>
<many-to-one name="ePackage" entity-name="EPackage" lazy="false"
insert="false" update="false" not-null="false">
<column not-null="false" unique="false"
name="`eclassifier_epackage_e_id`"/>
</many-to-one>
<list name="eTypeParameters" lazy="true" cascade="all,delete-
orphan">
<key update="true">
<column name="`eclassifier_etypeparameters_e_id`" not-
null="false" unique="false"/>
</key>
<list-index column="`eclassifier_etypeparameters_idx`"/>
<one-to-many entity-name="ETypeParameter"/>
</list>
</subclass>


I attach the complete mapping file.


thanks,



Guillaume.


Martin Taal <mtaal@elver.org> wrote in
news:f9hhot$si0$1@build.eclipse.org:

> Hi,
> and how does the hbm mapping of the ecore model itself look like?
> Especially the part around EClassifier.
>
> gr. Martin
>
> guillaume wrote:
>> Hi again,
>>
>> I attach the generated mapping for the meta-model coming from the
>> ecore file (mappingWithModelFromEcoreFile.xml) , the mapping for the
>> meta-model coming from Teneo (mappingWithModelFromTeneo.xml) , the
>> serialized version of my meta-model coming from Teneo
>> (debFromTeneo.ecore) and my original meta-model file (debFile.ecore).
>>
>> The difference between the 2 ecore file is that in my original meta
>> model, the subclasses are represented like this :
>> <eClassifiers xsi:type="ecore:EClass" name="Version"
>> eSuperTypes="#/1/Field"/>
>>
>> and in the serialized form coming from Teneo, I have this :
>> <eClassifiers xsi:type="ecore:EClass" name="Version">
>> <eGenericSuperTypes eClassifier="ecore:EClass
>> testdeb.ecore#/1/Field"/>
>> </eClassifiers>
>>
>>
>> Thanks,
>>
>>
>> Guillaume
>>
>>
>>
>>
>> Martin Taal <mtaal@elver.org> wrote in
>> news:f9hdp5$kh2$1@build.eclipse.org:
>>
>>> Hi Guillaume,
>>> If you encounter many problems then (imho) the best approach I can
>>> think of is take a small model and analyze the differences between
>>> the xml-serialization and the db-serialization (write the
>>> db-serialized model to an xml file and do a text compare) and then
>>> post these differences here in the newsgroup. I would use several
>>> small models each one of them covering a limited set of more complex
>>> part of your real-live models (for example one covering inheritance,
>>> one other for several associations, one for enumerates, one for
>>> edatatypes, etc.).
>>>
>>> Regarding your specific problem, it seems that the inheritance
>>> relations between your eclasses is not persisted in the database.
>>> Because of this: - the sub eclasses are stored in their own table
>>> (as Teneo does not see a supertype) - the inherited features are not
>>> visible in the subeclass (as the subeclass does not have a relation
>>> anymore to its supertype).
>>>
>>> Can you check/post the hibernate mapping for the eSuperType and
>>> eGenericSuperType feature of the eClass?
>>>
>>> gr. Martin
>>>
>>> guillaume wrote:
>>>> Hi all,
>>>>
>>>> I'm always experiencing problem with Teneo.
>>>>
>>>> I have models that are conformed to a meta model.
>>>>
>>>> The problem is that when I try to deserialize the model from an
>>>> ecore file, if I register the meta models packages from the meta
>>>> models loaded from an ecore file it works fine and I can
>>>> deserialize my model.
>>>>
>>>> But when I try to get my meta model from Teneo (assuming that the
>>>> meta model getting from Teneo vas previously persisted by taking
>>>> the meta model coming from the ecore file), I obtain an Exception :
>>>>
>>>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
>>>> 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
>>>> (XMLLoadImpl.java:81)
>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
>>>> (XMLLoadImpl.java:189)
>>>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
>>>> (XMLResourceImpl.java:180)
>>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>>> (ResourceImpl.java:1354)
>>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>>> (ResourceImpl.java:1155)
>>>> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
>>>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException:
>>>> Feature 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
>>>> (XMLHandler.java:1856)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
>>>> (XMLHandler.java:1820)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
>>>> (XMIHandler.java:149)
>>>> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
>>>> (XMLHandler.java:2570)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
>>>> (SAXXMIHandler.java:76)
>>>>
>>>> ....
>>>>
>>>>
>>>>
>>>> So, I have seen that the "val" feature that isn't found is an
>>>> inherited attribute. And If I remove all the inherited element from
>>>> my model It works.
>>>>
>>>>
>>>> I have also seen that the mapping generated by Teneo for a meta
>>>> model are not the same if the meta model come directly from my
>>>> ecore file or if it is a meta model persisted with Teneo.
>>>> With the same properties for the initialization of the hbdatastore
>>>> (inheritance mapping setted to SINGLE_TABLE), the subclasses are
>>>> not mapped in the same way :
>>>> - when the meta model come from the ecore file only one
>>>> table is
>>>> created for a class hierarchy as it is say on
>>>> http://www.elver.org/hibernate/inheritance.html
>>>>
>>>> - when the "same" meta model come from Teneo the mapping
>>>> create
>>>> also tables for the subclasses.
>>>>
>>>>
>>>> It is a problem for me because I have to do a models and meta
>>>> models repository, so I must be able to add/get/remove models
>>>> corresponding to meta models that are stored in Teneo (without the
>>>> ecore files containing the metamodels). But here the meta models
>>>> coming from file or coming from Teneo appears to not being
>>>> equivalent and it doesn't work...
>>>>
>>>> I'm trying to solve it from a long time but I con't find the
>>>> solution...
>>>>
>>>>
>>>> If anyone can help me, I will be very happy.
>>>>
>>>>
>>>>
>>>> Thanks,
>>>>
>>>>
>>>> Guillaume Doux
>>>>
>>>>
>>>>
>>>
>>
>
>


Re: [Teneo] Problems with inherited field - 1 attachment [message #93196 is a reply to message #93131] Fri, 10 August 2007 21:02 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090608060508000500000906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
I retested this and afaics it went fine (see the attached file, this one was read from the db). Your
debFromTeneo.ecore has a view strange sections:
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="ecore:EClass testdeb.ecore#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="ecore:EClass testdeb.ecore#/1/Field"/>
</eClassifiers>

What I don't understand is where this: ecore:EClass testdeb.ecore#
comes from. In the ecore file, I created, the uri is: /1/Field.

My feeling is that this has something to do with the way you create the resource which reads the
debFromTeneo.ecore (btw, this may not be the problem but hides why it does not work for you).

Also my experience with reading epackages from the db or the filesystem is that it needs to be done
through a resourceset this ensures that the packages are placed in the EPackage registry and that
this registry is used during reading.

Btw, here is the simplified code I use to read the ecore, persist it and read it back. There are a
number of calls to convenience methods (store.beginTransaction etc.) but for the rest it is pretty
simple. This code does not use a resourceset (not required for the tests) but in production code you
should do this. You can try to replicate this simple approach and then check if the output is
incorrect or correct.

{
final Resource fileRes = new XMIResourceImpl();
fileRes.load(this.getClass().getResourceAsStream("debFile.ecore "), Collections.EMPTY_MAP);
store.beginTransaction();
for (Object o : fileRes.getContents()) {
store.store(o);
}
store.commitTransaction();
}
{
store.beginTransaction();
final Resource res = new XMIResourceImpl();
for (Object o : store.getObjects(EPackage.class)) {
res.getContents().add((EObject) o);
}
final OutputStream os = new FileOutputStream("/home/mtaal/mytmp/test.ecore");
res.save(os, Collections.EMPTY_MAP);
store.commitTransaction();
}

gr. Martin

guillaume wrote:
> Hi,
>
> It's the mapping corresponding to the EcorePackage,
>
> the part arround the EClassifier is :
>
>
> <subclass name="org.eclipse.emf.ecore.impl.EClassifierImpl" entity-
> name="EClassifier" abstract="true" lazy="false" extends="ENamedElement"
> discriminator-value="EClassifier">
> <meta attribute="eclassName">EClassifier</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore
> </meta>
> <property name="instanceClassName" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false"
> name="`instanceclassname`"/>
> </property>
> <property name="instanceTypeName" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false"
> name="`instancetypename`"/>
> </property>
> <many-to-one name="ePackage" entity-name="EPackage" lazy="false"
> insert="false" update="false" not-null="false">
> <column not-null="false" unique="false"
> name="`eclassifier_epackage_e_id`"/>
> </many-to-one>
> <list name="eTypeParameters" lazy="true" cascade="all,delete-
> orphan">
> <key update="true">
> <column name="`eclassifier_etypeparameters_e_id`" not-
> null="false" unique="false"/>
> </key>
> <list-index column="`eclassifier_etypeparameters_idx`"/>
> <one-to-many entity-name="ETypeParameter"/>
> </list>
> </subclass>
>
>
> I attach the complete mapping file.
>
>
> thanks,
>
>
>
> Guillaume.
>
>
> Martin Taal <mtaal@elver.org> wrote in
> news:f9hhot$si0$1@build.eclipse.org:
>
>> Hi,
>> and how does the hbm mapping of the ecore model itself look like?
>> Especially the part around EClassifier.
>>
>> gr. Martin
>>
>> guillaume wrote:
>>> Hi again,
>>>
>>> I attach the generated mapping for the meta-model coming from the
>>> ecore file (mappingWithModelFromEcoreFile.xml) , the mapping for the
>>> meta-model coming from Teneo (mappingWithModelFromTeneo.xml) , the
>>> serialized version of my meta-model coming from Teneo
>>> (debFromTeneo.ecore) and my original meta-model file (debFile.ecore).
>>>
>>> The difference between the 2 ecore file is that in my original meta
>>> model, the subclasses are represented like this :
>>> <eClassifiers xsi:type="ecore:EClass" name="Version"
>>> eSuperTypes="#/1/Field"/>
>>>
>>> and in the serialized form coming from Teneo, I have this :
>>> <eClassifiers xsi:type="ecore:EClass" name="Version">
>>> <eGenericSuperTypes eClassifier="ecore:EClass
>>> testdeb.ecore#/1/Field"/>
>>> </eClassifiers>
>>>
>>>
>>> Thanks,
>>>
>>>
>>> Guillaume
>>>
>>>
>>>
>>>
>>> Martin Taal <mtaal@elver.org> wrote in
>>> news:f9hdp5$kh2$1@build.eclipse.org:
>>>
>>>> Hi Guillaume,
>>>> If you encounter many problems then (imho) the best approach I can
>>>> think of is take a small model and analyze the differences between
>>>> the xml-serialization and the db-serialization (write the
>>>> db-serialized model to an xml file and do a text compare) and then
>>>> post these differences here in the newsgroup. I would use several
>>>> small models each one of them covering a limited set of more complex
>>>> part of your real-live models (for example one covering inheritance,
>>>> one other for several associations, one for enumerates, one for
>>>> edatatypes, etc.).
>>>>
>>>> Regarding your specific problem, it seems that the inheritance
>>>> relations between your eclasses is not persisted in the database.
>>>> Because of this: - the sub eclasses are stored in their own table
>>>> (as Teneo does not see a supertype) - the inherited features are not
>>>> visible in the subeclass (as the subeclass does not have a relation
>>>> anymore to its supertype).
>>>>
>>>> Can you check/post the hibernate mapping for the eSuperType and
>>>> eGenericSuperType feature of the eClass?
>>>>
>>>> gr. Martin
>>>>
>>>> guillaume wrote:
>>>>> Hi all,
>>>>>
>>>>> I'm always experiencing problem with Teneo.
>>>>>
>>>>> I have models that are conformed to a meta model.
>>>>>
>>>>> The problem is that when I try to deserialize the model from an
>>>>> ecore file, if I register the meta models packages from the meta
>>>>> models loaded from an ecore file it works fine and I can
>>>>> deserialize my model.
>>>>>
>>>>> But when I try to get my meta model from Teneo (assuming that the
>>>>> meta model getting from Teneo vas previously persisted by taking
>>>>> the meta model coming from the ecore file), I obtain an Exception :
>>>>>
>>>>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
>>>>> 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
>>>>> (XMLLoadImpl.java:81)
>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
>>>>> (XMLLoadImpl.java:189)
>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
>>>>> (XMLResourceImpl.java:180)
>>>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>>>> (ResourceImpl.java:1354)
>>>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>>>> (ResourceImpl.java:1155)
>>>>> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
>>>>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException:
>>>>> Feature 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
>>>>> (XMLHandler.java:1856)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
>>>>> (XMLHandler.java:1820)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
>>>>> (XMIHandler.java:149)
>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
>>>>> (XMLHandler.java:2570)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
>>>>> (SAXXMIHandler.java:76)
>>>>>
>>>>> ....
>>>>>
>>>>>
>>>>>
>>>>> So, I have seen that the "val" feature that isn't found is an
>>>>> inherited attribute. And If I remove all the inherited element from
>>>>> my model It works.
>>>>>
>>>>>
>>>>> I have also seen that the mapping generated by Teneo for a meta
>>>>> model are not the same if the meta model come directly from my
>>>>> ecore file or if it is a meta model persisted with Teneo.
>>>>> With the same properties for the initialization of the hbdatastore
>>>>> (inheritance mapping setted to SINGLE_TABLE), the subclasses are
>>>>> not mapped in the same way :
>>>>> - when the meta model come from the ecore file only one
>>>>> table is
>>>>> created for a class hierarchy as it is say on
>>>>> http://www.elver.org/hibernate/inheritance.html
>>>>>
>>>>> - when the "same" meta model come from Teneo the mapping
>>>>> create
>>>>> also tables for the subclasses.
>>>>>
>>>>>
>>>>> It is a problem for me because I have to do a models and meta
>>>>> models repository, so I must be able to add/get/remove models
>>>>> corresponding to meta models that are stored in Teneo (without the
>>>>> ecore files containing the metamodels). But here the meta models
>>>>> coming from file or coming from Teneo appears to not being
>>>>> equivalent and it doesn't work...
>>>>>
>>>>> I'm trying to solve it from a long time but I con't find the
>>>>> solution...
>>>>>
>>>>>
>>>>> If anyone can help me, I will be very happy.
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>>
>>>>> Guillaume Doux
>>>>>
>>>>>
>>>>>
>>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>
> <!-- Generated by Teneo on Fri Aug 10 14:17:28 CEST 2007 -->
> <hibernate-mapping auto-import="false">
> <typedef name="ecore.EDiagnosticChain" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EDiagnosticChain</param>
> </typedef>
> <typedef name="ecore.EEList" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EEList</param>
> </typedef>
> <typedef name="ecore.EEnumerator" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EEnumerator</param>
> </typedef>
> <typedef name="ecore.EFeatureMap" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EFeatureMap</param>
> </typedef>
> <typedef name="ecore.EFeatureMapEntry" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EFeatureMapEntry</param>
> </typedef>
> <typedef name="ecore.EMap" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EMap</param>
> </typedef>
> <typedef name="ecore.EResource" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EResource</param>
> </typedef>
> <typedef name="ecore.EResourceSet" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EResourceSet</param>
> </typedef>
> <typedef name="ecore.ETreeIterator" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">ETreeIterator</param>
> </typedef>
> <class name="org.eclipse.emf.ecore.impl.BasicEObjectImpl" entity-name="ecore_EObject" abstract="false" lazy="false" discriminator-value="ecore_EObject" table="`ecore_eobject`">
> <meta attribute="eclassName">EObject</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <id type="long" name="e_id" column="e_id" access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version" access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> </class>
> <subclass name="org.eclipse.emf.ecore.impl.EModelElementImpl" entity-name="EModelElement" abstract="true" lazy="false" extends="ecore_EObject" discriminator-value="EModelElement">
> <meta attribute="eclassName">EModelElement</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <list name="eAnnotations" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eannotation_emodelelement_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`emodelelement_eannotations_idx`"/>
> <one-to-many entity-name="EAnnotation"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.ENamedElementImpl" entity-name="ENamedElement" abstract="true" lazy="false" extends="EModelElement" discriminator-value="ENamedElement">
> <meta attribute="eclassName">ENamedElement</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="name" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.ETypedElementImpl" entity-name="ETypedElement" abstract="true" lazy="false" extends="ENamedElement" discriminator-value="ETypedElement">
> <meta attribute="eclassName">ETypedElement</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="ordered" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`ordered`"/>
> </property>
> <property name="unique" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`unique`"/>
> </property>
> <property name="lowerBound" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`lowerbound`"/>
> </property>
> <property name="upperBound" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`upperbound`"/>
> </property>
> <many-to-one name="eType" entity-name="EClassifier" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`eclassifier_etype_e_id`"/>
> </many-to-one>
> <many-to-one name="eGenericType" entity-name="EGenericType" cascade="all" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`egenerictype_egenerictype_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EStructuralFeatureImpl" entity-name="EStructuralFeature" abstract="true" lazy="false" extends="ETypedElement" discriminator-value="EStructuralFeature">
> <meta attribute="eclassName">EStructuralFeature</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="changeable" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`changeable`"/>
> </property>
> <property name="volatile" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`volatile`"/>
> </property>
> <property name="transient" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`transient`"/>
> </property>
> <property name="defaultValueLiteral" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`defaultvalueliteral`"/>
> </property>
> <property name="unsettable" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`unsettable`"/>
> </property>
> <property name="derived" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`derived`"/>
> </property>
> <many-to-one name="eContainingClass" entity-name="EClass" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`estructuralfeature_econtainingclass_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EAttributeImpl" entity-name="EAttribute" abstract="false" lazy="false" extends="EStructuralFeature" discriminator-value="EAttribute">
> <meta attribute="eclassName">EAttribute</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="iD" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`id`"/>
> </property>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EAnnotationImpl" entity-name="EAnnotation" abstract="false" lazy="false" extends="EModelElement" discriminator-value="EAnnotation">
> <meta attribute="eclassName">EAnnotation</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="source" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`source`"/>
> </property>
> <map name="details" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eannotation_details_e_id`" not-null="false" unique="false"/>
> </key>
> <map-key type="java.lang.String"/>
> <element type="java.lang.String"/>
> </map>
> <many-to-one name="eModelElement" entity-name="EModelElement" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eannotation_emodelelement_e_id`"/>
> </many-to-one>
> <list name="contents" table="`eannotation_contents`" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eannotation_e_id`" not-null="true" unique="false"/>
> </key>
> <list-index column="`eannotation_contents_idx`"/>
> <many-to-any id-type="long">
> <column not-null="true" unique="false" name="`contents_type`"/>
> <column not-null="true" unique="false" name="`contents_id`"/>
> </many-to-any>
> </list>
> <list name="references" table="`eannotation_references`" lazy="true">
> <key update="true">
> <column name="`eannotation_e_id`" not-null="true" unique="false"/>
> </key>
> <list-index column="`eannotation_references_idx`"/>
> <many-to-any id-type="long">
> <column not-null="true" unique="false" name="`references_type`"/>
> <column not-null="true" unique="false" name="`references_id`"/>
> </many-to-any>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EClassifierImpl" entity-name="EClassifier" abstract="true" lazy="false" extends="ENamedElement" discriminator-value="EClassifier">
> <meta attribute="eclassName">EClassifier</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="instanceClassName" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`instanceclassname`"/>
> </property>
> <property name="instanceTypeName" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`instancetypename`"/>
> </property>
> <many-to-one name="ePackage" entity-name="EPackage" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eclassifier_epackage_e_id`"/>
> </many-to-one>
> <list name="eTypeParameters" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eclassifier_etypeparameters_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclassifier_etypeparameters_idx`"/>
> <one-to-many entity-name="ETypeParameter"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EClassImpl" entity-name="EClass" abstract="false" lazy="false" extends="EClassifier" discriminator-value="EClass">
> <meta attribute="eclassName">EClass</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="abstract" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`abstract`"/>
> </property>
> <property name="interface" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`interface`"/>
> </property>
> <list name="eSuperTypes" lazy="true">
> <key update="true">
> <column name="`eclass_esupertypes_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclass_esupertypes_idx`"/>
> <one-to-many entity-name="EClass"/>
> </list>
> <list name="eOperations" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eoperation_econtainingclass_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclass_eoperations_idx`"/>
> <one-to-many entity-name="EOperation"/>
> </list>
> <list name="eStructuralFeatures" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`estructuralfeature_econtainingclass_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclass_estructuralfeatures_idx`"/>
> <one-to-many entity-name="EStructuralFeature"/>
> </list>
> <list name="eGenericSuperTypes" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eclass_egenericsupertypes_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclass_egenericsupertypes_idx`"/>
> <one-to-many entity-name="EGenericType"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EDataTypeImpl" entity-name="EDataType" abstract="false" lazy="false" extends="EClassifier" discriminator-value="EDataType">
> <meta attribute="eclassName">EDataType</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="serializable" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`serializable`"/>
> </property>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EEnumImpl" entity-name="EEnum" abstract="false" lazy="false" extends="EDataType" discriminator-value="EEnum">
> <meta attribute="eclassName">EEnum</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <list name="eLiterals" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eenumliteral_eenum_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eenum_eliterals_idx`"/>
> <one-to-many entity-name="EEnumLiteral"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EEnumLiteralImpl" entity-name="EEnumLiteral" abstract="false" lazy="false" extends="ENamedElement" discriminator-value="EEnumLiteral">
> <meta attribute="eclassName">EEnumLiteral</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="value" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`value`"/>
> </property>
> <property name="literal" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`literal`"/>
> </property>
> <many-to-one name="eEnum" entity-name="EEnum" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eenumliteral_eenum_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EFactoryImpl" entity-name="EFactory" abstract="false" lazy="false" extends="EModelElement" discriminator-value="EFactory">
> <meta attribute="eclassName">EFactory</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EOperationImpl" entity-name="EOperation" abstract="false" lazy="false" extends="ETypedElement" discriminator-value="EOperation">
> <meta attribute="eclassName">EOperation</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <many-to-one name="eContainingClass" entity-name="EClass" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eoperation_econtainingclass_e_id`"/>
> </many-to-one>
> <list name="eTypeParameters" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eoperation_etypeparameters_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eoperation_etypeparameters_idx`"/>
> <one-to-many entity-name="ETypeParameter"/>
> </list>
> <list name="eParameters" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eparameter_eoperation_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eoperation_eparameters_idx`"/>
> <one-to-many entity-name="EParameter"/>
> </list>
> <list name="eExceptions" lazy="true">
> <key update="true">
> <column name="`eoperation_eexceptions_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eoperation_eexceptions_idx`"/>
> <one-to-many entity-name="EClassifier"/>
> </list>
> <list name="eGenericExceptions" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eoperation_egenericexceptions_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eoperation_egenericexceptions_idx`"/>
> <one-to-many entity-name="EGenericType"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EPackageImpl" entity-name="EPackage" abstract="false" lazy="false" extends="ENamedElement" discriminator-value="EPackage">
> <meta attribute="eclassName">EPackage</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="nsURI" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`nsuri`"/>
> </property>
> <property name="nsPrefix" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`nsprefix`"/>
> </property>
> <list name="eClassifiers" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eclassifier_epackage_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`epackage_eclassifiers_idx`"/>
> <one-to-many entity-name="EClassifier"/>
> </list>
> <list name="eSubpackages" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`epackage_esuperpackage_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`epackage_esubpackages_idx`"/>
> <one-to-many entity-name="EPackage"/>
> </list>
> <many-to-one name="eSuperPackage" entity-name="EPackage" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`epackage_esuperpackage_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EParameterImpl" entity-name="EParameter" abstract="false" lazy="false" extends="ETypedElement" discriminator-value="EParameter">
> <meta attribute="eclassName">EParameter</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <many-to-one name="eOperation" entity-name="EOperation" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eparameter_eoperation_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EReferenceImpl" entity-name="EReference" abstract="false" lazy="false" extends="EStructuralFeature" discriminator-value="EReference">
> <meta attribute="eclassName">EReference</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="containment" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`containment`"/>
> </property>
> <property name="resolveProxies" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`resolveproxies`"/>
> </property>
> <many-to-one name="eOpposite" entity-name="EReference" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`ereference_eopposite_e_id`"/>
> </many-to-one>
> <list name="eKeys" lazy="true">
> <key update="true">
> <column name="`ereference_ekeys_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`ereference_ekeys_idx`"/>
> <one-to-many entity-name="EAttribute"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EGenericTypeImpl" entity-name="EGenericType" abstract="false" lazy="false" extends="ecore_EObject" discriminator-value="EGenericType">
> <meta attribute="eclassName">EGenericType</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <many-to-one name="eUpperBound" entity-name="EGenericType" cascade="all" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`egenerictype_eupperbound_e_id`"/>
> </many-to-one>
> <list name="eTypeArguments" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`egenerictype_etypearguments_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`egenerictype_etypearguments_idx`"/>
> <one-to-many entity-name="EGenericType"/>
> </list>
> <many-to-one name="eLowerBound" entity-name="EGenericType" cascade="all" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`egenerictype_elowerbound_e_id`"/>
> </many-to-one>
> <many-to-one name="eTypeParameter" entity-name="ETypeParameter" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`etypeparameter_etypeparameter_e_id`"/>
> </many-to-one>
> <many-to-one name="eClassifier" entity-name="EClassifier" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`eclassifier_eclassifier_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.ETypeParameterImpl" entity-name="ETypeParameter" abstract="false" lazy="false" extends="ENamedElement" discriminator-value="ETypeParameter">
> <meta attribute="eclassName">ETypeParameter</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <list name="eBounds" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`etypeparameter_ebounds_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`etypeparameter_ebounds_idx`"/>
> <one-to-many entity-name="EGenericType"/>
> </list>
> </subclass>
> </hibernate-mapping>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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

--------------090608060508000500000906
Content-Type: text/xml;
name="deb_martin.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="deb_martin.ecore"

<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="int"/>
<eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false" lowerBound="1" eType="/1/Databin" containment="true" eOpposite="/1/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false" lowerBound="1" eType="/1/Archcontrol" containment="true" eOpposite="/1/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false" lowerBound="1" eType="/1/Archdata" containment="true" eOpposite="/1/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false" lowerBound="1" eType="/1/Deb" eOpposite="/1/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false" upperBound="-1" eType="/1/Bloc" containment="true" eOpposite="/1/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false" lowerBound="1" eType="/1/Databin" eOpposite="/1/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false" upperBound="-1" eType="/1/Field" containment="true" eOpposite="/1/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false" lowerBound="1" eType="/1/Bloc" eOpposite="/1/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_name">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false" lowerBound="1" eType="/1/Deb" eOpposite="/1/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false" upperBound="-1" eType="/1/Script" containment="true" eOpposite="/1/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false" lowerBound="1" eType="/1/Archcontrol" eOpposite="/1/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false" lowerBound="1" eType="/1/Deb" eOpposite="/1/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false" upperBound="-1" eType="/1/File" containment="true" eOpposite="/1/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false" lowerBound="1" eType="/1/Archdata" eOpposite="/1/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------090608060508000500000906--
Re: [Teneo] Problems with inherited field [message #93257 is a reply to message #93196] Sat, 11 August 2007 09:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

Before send you the preceding message I have renamed the attached file,
the previous name debFromTeneo.ecore was testdeb.ecore...
But I did not know wy the name of the file is adding here.

I will try your code and tell you If it works...

Thanks,

Guillaume


Martin Taal a écrit :
> Hi,
> I retested this and afaics it went fine (see the attached file, this one
> was read from the db). Your debFromTeneo.ecore has a view strange sections:
> <eClassifiers xsi:type="ecore:EClass" name="Dependancy">
> <eGenericSuperTypes eClassifier="ecore:EClass
> testdeb.ecore#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
> <eGenericSuperTypes eClassifier="ecore:EClass
> testdeb.ecore#/1/Field"/>
> </eClassifiers>
>
> What I don't understand is where this: ecore:EClass testdeb.ecore#
> comes from. In the ecore file, I created, the uri is: /1/Field.
>
> My feeling is that this has something to do with the way you create the
> resource which reads the debFromTeneo.ecore (btw, this may not be the
> problem but hides why it does not work for you).
>
> Also my experience with reading epackages from the db or the filesystem
> is that it needs to be done through a resourceset this ensures that the
> packages are placed in the EPackage registry and that this registry is
> used during reading.
>
> Btw, here is the simplified code I use to read the ecore, persist it and
> read it back. There are a number of calls to convenience methods
> (store.beginTransaction etc.) but for the rest it is pretty simple. This
> code does not use a resourceset (not required for the tests) but in
> production code you should do this. You can try to replicate this simple
> approach and then check if the output is incorrect or correct.
>
> {
> final Resource fileRes = new XMIResourceImpl();
>
> fileRes.load(this.getClass().getResourceAsStream("debFile.ecore "),
> Collections.EMPTY_MAP);
> store.beginTransaction();
> for (Object o : fileRes.getContents()) {
> store.store(o);
> }
> store.commitTransaction();
> }
> {
> store.beginTransaction();
> final Resource res = new XMIResourceImpl();
> for (Object o : store.getObjects(EPackage.class)) {
> res.getContents().add((EObject) o);
> }
> final OutputStream os = new
> FileOutputStream("/home/mtaal/mytmp/test.ecore");
> res.save(os, Collections.EMPTY_MAP);
> store.commitTransaction();
> }
>
> gr. Martin
>
Re: [Teneo] Problems with inherited field [message #93314 is a reply to message #93257] Mon, 13 August 2007 18:02 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

I have try your code, it works fine :)

Once the "ecore:EClass myfile.ecore" removed from the file, all the
problems with the mapping are gone out...

It need more test to see if all works fine, but it seems to be...

thanks a lot !

Guillaume

guillaume a écrit :
> Hi,
>
> Before send you the preceding message I have renamed the attached file,
> the previous name debFromTeneo.ecore was testdeb.ecore...
> But I did not know wy the name of the file is adding here.
>
> I will try your code and tell you If it works...
>
> Thanks,
>
> Guillaume
>
>
> Martin Taal a écrit :
>> Hi,
>> I retested this and afaics it went fine (see the attached file, this
>> one was read from the db). Your debFromTeneo.ecore has a view strange
>> sections:
>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy">
>> <eGenericSuperTypes eClassifier="ecore:EClass
>> testdeb.ecore#/1/Field"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
>> <eGenericSuperTypes eClassifier="ecore:EClass
>> testdeb.ecore#/1/Field"/>
>> </eClassifiers>
>>
>> What I don't understand is where this: ecore:EClass testdeb.ecore#
>> comes from. In the ecore file, I created, the uri is: /1/Field.
>>
>> My feeling is that this has something to do with the way you create
>> the resource which reads the debFromTeneo.ecore (btw, this may not be
>> the problem but hides why it does not work for you).
>>
>> Also my experience with reading epackages from the db or the
>> filesystem is that it needs to be done through a resourceset this
>> ensures that the packages are placed in the EPackage registry and that
>> this registry is used during reading.
>>
>> Btw, here is the simplified code I use to read the ecore, persist it
>> and read it back. There are a number of calls to convenience methods
>> (store.beginTransaction etc.) but for the rest it is pretty simple.
>> This code does not use a resourceset (not required for the tests) but
>> in production code you should do this. You can try to replicate this
>> simple approach and then check if the output is incorrect or correct.
>>
>> {
>> final Resource fileRes = new XMIResourceImpl();
>>
>> fileRes.load(this.getClass().getResourceAsStream("debFile.ecore "),
>> Collections.EMPTY_MAP);
>> store.beginTransaction();
>> for (Object o : fileRes.getContents()) {
>> store.store(o);
>> }
>> store.commitTransaction();
>> }
>> {
>> store.beginTransaction();
>> final Resource res = new XMIResourceImpl();
>> for (Object o : store.getObjects(EPackage.class)) {
>> res.getContents().add((EObject) o);
>> }
>> final OutputStream os = new
>> FileOutputStream("/home/mtaal/mytmp/test.ecore");
>> res.save(os, Collections.EMPTY_MAP);
>> store.commitTransaction();
>> }
>>
>> gr. Martin
>>
Re: [Teneo] Problems with inherited field [message #609446 is a reply to message #92934] Fri, 10 August 2007 10:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Guillaume,
If you encounter many problems then (imho) the best approach I can think of is take a small model
and analyze the differences between the xml-serialization and the db-serialization (write the
db-serialized model to an xml file and do a text compare) and then post these differences here in
the newsgroup. I would use several small models each one of them covering a limited set of more
complex part of your real-live models (for example one covering inheritance, one other for several
associations, one for enumerates, one for edatatypes, etc.).

Regarding your specific problem, it seems that the inheritance relations between your eclasses is
not persisted in the database. Because of this:
- the sub eclasses are stored in their own table (as Teneo does not see a supertype)
- the inherited features are not visible in the subeclass (as the subeclass does not have a relation
anymore to its supertype).

Can you check/post the hibernate mapping for the eSuperType and eGenericSuperType feature of the eClass?

gr. Martin

guillaume wrote:
> Hi all,
>
> I'm always experiencing problem with Teneo.
>
> I have models that are conformed to a meta model.
>
> The problem is that when I try to deserialize the model from an ecore
> file, if I register the meta models packages from the meta models loaded
> from an ecore file it works fine and I can deserialize my model.
>
> But when I try to get my meta model from Teneo (assuming that the meta
> model getting from Teneo vas previously persisted by taking the meta
> model coming from the ecore file), I obtain an Exception :
>
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
> 'val' not found. (file:///C:/eclipse-SDK-3.3-
> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
> (XMLLoadImpl.java:81)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
> (XMLLoadImpl.java:189)
> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
> (XMLResourceImpl.java:180)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
> (ResourceImpl.java:1354)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
> (ResourceImpl.java:1155)
> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
> 'val' not found. (file:///C:/eclipse-SDK-3.3-
> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
> (XMLHandler.java:1856)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
> (XMLHandler.java:1820)
> at org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
> (XMIHandler.java:149)
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
> (XMLHandler.java:2570)
> at
> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
> (SAXXMIHandler.java:76)
>
> ....
>
>
>
> So, I have seen that the "val" feature that isn't found is an inherited
> attribute. And If I remove all the inherited element from my model It
> works.
>
>
> I have also seen that the mapping generated by Teneo for a meta model
> are not the same if the meta model come directly from my ecore file or
> if it is a meta model persisted with Teneo.
> With the same properties for the initialization of the hbdatastore
> (inheritance mapping setted to SINGLE_TABLE), the subclasses are not
> mapped in the same way :
> - when the meta model come from the ecore file only one table is
> created for a class hierarchy as it is say on
> http://www.elver.org/hibernate/inheritance.html
>
> - when the "same" meta model come from Teneo the mapping create
> also tables for the subclasses.
>
>
> It is a problem for me because I have to do a models and meta models
> repository, so I must be able to add/get/remove models corresponding to
> meta models that are stored in Teneo (without the ecore files containing
> the metamodels). But here the meta models coming from file or coming
> from Teneo appears to not being equivalent and it doesn't work...
>
> I'm trying to solve it from a long time but I con't find the solution...
>
>
> If anyone can help me, I will be very happy.
>
>
>
> Thanks,
>
>
> Guillaume Doux
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] Problems with inherited field [message #609448 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi again,

I attach the generated mapping for the meta-model coming from the ecore
file (mappingWithModelFromEcoreFile.xml) , the mapping for the meta-model
coming from Teneo (mappingWithModelFromTeneo.xml) , the serialized version
of my meta-model coming from Teneo (debFromTeneo.ecore) and my original
meta-model file (debFile.ecore).

The difference between the 2 ecore file is that in my original meta model,
the subclasses are represented like this :
<eClassifiers xsi:type="ecore:EClass" name="Version"
eSuperTypes="#/1/Field"/>

and in the serialized form coming from Teneo, I have this :
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="ecore:EClass
testdeb.ecore#/1/Field"/>
</eClassifiers>


Thanks,


Guillaume




Martin Taal <mtaal@elver.org> wrote in
news:f9hdp5$kh2$1@build.eclipse.org:

> Hi Guillaume,
> If you encounter many problems then (imho) the best approach I can
> think of is take a small model and analyze the differences between the
> xml-serialization and the db-serialization (write the db-serialized
> model to an xml file and do a text compare) and then post these
> differences here in the newsgroup. I would use several small models
> each one of them covering a limited set of more complex part of your
> real-live models (for example one covering inheritance, one other for
> several associations, one for enumerates, one for edatatypes, etc.).
>
> Regarding your specific problem, it seems that the inheritance
> relations between your eclasses is not persisted in the database.
> Because of this: - the sub eclasses are stored in their own table (as
> Teneo does not see a supertype) - the inherited features are not
> visible in the subeclass (as the subeclass does not have a relation
> anymore to its supertype).
>
> Can you check/post the hibernate mapping for the eSuperType and
> eGenericSuperType feature of the eClass?
>
> gr. Martin
>
> guillaume wrote:
>> Hi all,
>>
>> I'm always experiencing problem with Teneo.
>>
>> I have models that are conformed to a meta model.
>>
>> The problem is that when I try to deserialize the model from an ecore
>> file, if I register the meta models packages from the meta models
>> loaded from an ecore file it works fine and I can deserialize my
>> model.
>>
>> But when I try to get my meta model from Teneo (assuming that the
>> meta model getting from Teneo vas previously persisted by taking the
>> meta model coming from the ecore file), I obtain an Exception :
>>
>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
>> 'val' not found. (file:///C:/eclipse-SDK-3.3-
>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
>> (XMLLoadImpl.java:81)
>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
>> (XMLLoadImpl.java:189)
>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
>> (XMLResourceImpl.java:180)
>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>> (ResourceImpl.java:1354)
>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>> (ResourceImpl.java:1155)
>> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException:
>> Feature 'val' not found. (file:///C:/eclipse-SDK-3.3-
>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
>> (XMLHandler.java:1856)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
>> (XMLHandler.java:1820)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
>> (XMIHandler.java:149)
>> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
>> (XMLHandler.java:2570)
>> at
>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
>> (SAXXMIHandler.java:76)
>>
>> ....
>>
>>
>>
>> So, I have seen that the "val" feature that isn't found is an
>> inherited attribute. And If I remove all the inherited element from
>> my model It works.
>>
>>
>> I have also seen that the mapping generated by Teneo for a meta model
>> are not the same if the meta model come directly from my ecore file
>> or if it is a meta model persisted with Teneo.
>> With the same properties for the initialization of the hbdatastore
>> (inheritance mapping setted to SINGLE_TABLE), the subclasses are not
>> mapped in the same way :
>> - when the meta model come from the ecore file only one
>> table is
>> created for a class hierarchy as it is say on
>> http://www.elver.org/hibernate/inheritance.html
>>
>> - when the "same" meta model come from Teneo the mapping
>> create
>> also tables for the subclasses.
>>
>>
>> It is a problem for me because I have to do a models and meta models
>> repository, so I must be able to add/get/remove models corresponding
>> to meta models that are stored in Teneo (without the ecore files
>> containing the metamodels). But here the meta models coming from file
>> or coming from Teneo appears to not being equivalent and it doesn't
>> work...
>>
>> I'm trying to solve it from a long time but I con't find the
>> solution...
>>
>>
>> If anyone can help me, I will be very happy.
>>
>>
>>
>> Thanks,
>>
>>
>> Guillaume Doux
>>
>>
>>
>
>
Re: [Teneo] Problems with inherited field - File 1 of 4 - debFile.ecore (1/1) [message #609449 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Re: [Teneo] Problems with inherited field - File 2 of 4 - debFromTeneo.ecore (1/1) [message #609450 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Re: [Teneo] Problems with inherited field - File 3 of 4 - mappingWithModelFromEcoreFile.xml (1/1) [message #609451 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Re: [Teneo] Problems with inherited field - File 4 of 4 - mappingWithModelFromTeneo.xml (1/1) [message #609452 is a reply to message #92961] Fri, 10 August 2007 10:59 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Re: [Teneo] Problems with inherited field [message #609453 is a reply to message #93005] Fri, 10 August 2007 11:22 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
and how does the hbm mapping of the ecore model itself look like? Especially the part around
EClassifier.

gr. Martin

guillaume wrote:
> Hi again,
>
> I attach the generated mapping for the meta-model coming from the ecore
> file (mappingWithModelFromEcoreFile.xml) , the mapping for the meta-model
> coming from Teneo (mappingWithModelFromTeneo.xml) , the serialized version
> of my meta-model coming from Teneo (debFromTeneo.ecore) and my original
> meta-model file (debFile.ecore).
>
> The difference between the 2 ecore file is that in my original meta model,
> the subclasses are represented like this :
> <eClassifiers xsi:type="ecore:EClass" name="Version"
> eSuperTypes="#/1/Field"/>
>
> and in the serialized form coming from Teneo, I have this :
> <eClassifiers xsi:type="ecore:EClass" name="Version">
> <eGenericSuperTypes eClassifier="ecore:EClass
> testdeb.ecore#/1/Field"/>
> </eClassifiers>
>
>
> Thanks,
>
>
> Guillaume
>
>
>
>
> Martin Taal <mtaal@elver.org> wrote in
> news:f9hdp5$kh2$1@build.eclipse.org:
>
>> Hi Guillaume,
>> If you encounter many problems then (imho) the best approach I can
>> think of is take a small model and analyze the differences between the
>> xml-serialization and the db-serialization (write the db-serialized
>> model to an xml file and do a text compare) and then post these
>> differences here in the newsgroup. I would use several small models
>> each one of them covering a limited set of more complex part of your
>> real-live models (for example one covering inheritance, one other for
>> several associations, one for enumerates, one for edatatypes, etc.).
>>
>> Regarding your specific problem, it seems that the inheritance
>> relations between your eclasses is not persisted in the database.
>> Because of this: - the sub eclasses are stored in their own table (as
>> Teneo does not see a supertype) - the inherited features are not
>> visible in the subeclass (as the subeclass does not have a relation
>> anymore to its supertype).
>>
>> Can you check/post the hibernate mapping for the eSuperType and
>> eGenericSuperType feature of the eClass?
>>
>> gr. Martin
>>
>> guillaume wrote:
>>> Hi all,
>>>
>>> I'm always experiencing problem with Teneo.
>>>
>>> I have models that are conformed to a meta model.
>>>
>>> The problem is that when I try to deserialize the model from an ecore
>>> file, if I register the meta models packages from the meta models
>>> loaded from an ecore file it works fine and I can deserialize my
>>> model.
>>>
>>> But when I try to get my meta model from Teneo (assuming that the
>>> meta model getting from Teneo vas previously persisted by taking the
>>> meta model coming from the ecore file), I obtain an Exception :
>>>
>>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
>>> 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
>>> (XMLLoadImpl.java:81)
>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
>>> (XMLLoadImpl.java:189)
>>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
>>> (XMLResourceImpl.java:180)
>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>> (ResourceImpl.java:1354)
>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>> (ResourceImpl.java:1155)
>>> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
>>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException:
>>> Feature 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
>>> (XMLHandler.java:1856)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
>>> (XMLHandler.java:1820)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
>>> (XMIHandler.java:149)
>>> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
>>> (XMLHandler.java:2570)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
>>> (SAXXMIHandler.java:76)
>>>
>>> ....
>>>
>>>
>>>
>>> So, I have seen that the "val" feature that isn't found is an
>>> inherited attribute. And If I remove all the inherited element from
>>> my model It works.
>>>
>>>
>>> I have also seen that the mapping generated by Teneo for a meta model
>>> are not the same if the meta model come directly from my ecore file
>>> or if it is a meta model persisted with Teneo.
>>> With the same properties for the initialization of the hbdatastore
>>> (inheritance mapping setted to SINGLE_TABLE), the subclasses are not
>>> mapped in the same way :
>>> - when the meta model come from the ecore file only one
>>> table is
>>> created for a class hierarchy as it is say on
>>> http://www.elver.org/hibernate/inheritance.html
>>>
>>> - when the "same" meta model come from Teneo the mapping
>>> create
>>> also tables for the subclasses.
>>>
>>>
>>> It is a problem for me because I have to do a models and meta models
>>> repository, so I must be able to add/get/remove models corresponding
>>> to meta models that are stored in Teneo (without the ecore files
>>> containing the metamodels). But here the meta models coming from file
>>> or coming from Teneo appears to not being equivalent and it doesn't
>>> work...
>>>
>>> I'm trying to solve it from a long time but I con't find the
>>> solution...
>>>
>>>
>>> If anyone can help me, I will be very happy.
>>>
>>>
>>>
>>> Thanks,
>>>
>>>
>>> Guillaume Doux
>>>
>>>
>>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] Problems with inherited field - 1 attachment [message #609455 is a reply to message #93101] Fri, 10 August 2007 12:38 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

It's the mapping corresponding to the EcorePackage,

the part arround the EClassifier is :


<subclass name="org.eclipse.emf.ecore.impl.EClassifierImpl" entity-
name="EClassifier" abstract="true" lazy="false" extends="ENamedElement"
discriminator-value="EClassifier">
<meta attribute="eclassName">EClassifier</meta>
<meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore
</meta>
<property name="instanceClassName" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false"
name="`instanceclassname`"/>
</property>
<property name="instanceTypeName" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false"
name="`instancetypename`"/>
</property>
<many-to-one name="ePackage" entity-name="EPackage" lazy="false"
insert="false" update="false" not-null="false">
<column not-null="false" unique="false"
name="`eclassifier_epackage_e_id`"/>
</many-to-one>
<list name="eTypeParameters" lazy="true" cascade="all,delete-
orphan">
<key update="true">
<column name="`eclassifier_etypeparameters_e_id`" not-
null="false" unique="false"/>
</key>
<list-index column="`eclassifier_etypeparameters_idx`"/>
<one-to-many entity-name="ETypeParameter"/>
</list>
</subclass>


I attach the complete mapping file.


thanks,



Guillaume.


Martin Taal <mtaal@elver.org> wrote in
news:f9hhot$si0$1@build.eclipse.org:

> Hi,
> and how does the hbm mapping of the ecore model itself look like?
> Especially the part around EClassifier.
>
> gr. Martin
>
> guillaume wrote:
>> Hi again,
>>
>> I attach the generated mapping for the meta-model coming from the
>> ecore file (mappingWithModelFromEcoreFile.xml) , the mapping for the
>> meta-model coming from Teneo (mappingWithModelFromTeneo.xml) , the
>> serialized version of my meta-model coming from Teneo
>> (debFromTeneo.ecore) and my original meta-model file (debFile.ecore).
>>
>> The difference between the 2 ecore file is that in my original meta
>> model, the subclasses are represented like this :
>> <eClassifiers xsi:type="ecore:EClass" name="Version"
>> eSuperTypes="#/1/Field"/>
>>
>> and in the serialized form coming from Teneo, I have this :
>> <eClassifiers xsi:type="ecore:EClass" name="Version">
>> <eGenericSuperTypes eClassifier="ecore:EClass
>> testdeb.ecore#/1/Field"/>
>> </eClassifiers>
>>
>>
>> Thanks,
>>
>>
>> Guillaume
>>
>>
>>
>>
>> Martin Taal <mtaal@elver.org> wrote in
>> news:f9hdp5$kh2$1@build.eclipse.org:
>>
>>> Hi Guillaume,
>>> If you encounter many problems then (imho) the best approach I can
>>> think of is take a small model and analyze the differences between
>>> the xml-serialization and the db-serialization (write the
>>> db-serialized model to an xml file and do a text compare) and then
>>> post these differences here in the newsgroup. I would use several
>>> small models each one of them covering a limited set of more complex
>>> part of your real-live models (for example one covering inheritance,
>>> one other for several associations, one for enumerates, one for
>>> edatatypes, etc.).
>>>
>>> Regarding your specific problem, it seems that the inheritance
>>> relations between your eclasses is not persisted in the database.
>>> Because of this: - the sub eclasses are stored in their own table
>>> (as Teneo does not see a supertype) - the inherited features are not
>>> visible in the subeclass (as the subeclass does not have a relation
>>> anymore to its supertype).
>>>
>>> Can you check/post the hibernate mapping for the eSuperType and
>>> eGenericSuperType feature of the eClass?
>>>
>>> gr. Martin
>>>
>>> guillaume wrote:
>>>> Hi all,
>>>>
>>>> I'm always experiencing problem with Teneo.
>>>>
>>>> I have models that are conformed to a meta model.
>>>>
>>>> The problem is that when I try to deserialize the model from an
>>>> ecore file, if I register the meta models packages from the meta
>>>> models loaded from an ecore file it works fine and I can
>>>> deserialize my model.
>>>>
>>>> But when I try to get my meta model from Teneo (assuming that the
>>>> meta model getting from Teneo vas previously persisted by taking
>>>> the meta model coming from the ecore file), I obtain an Exception :
>>>>
>>>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
>>>> 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
>>>> (XMLLoadImpl.java:81)
>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
>>>> (XMLLoadImpl.java:189)
>>>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
>>>> (XMLResourceImpl.java:180)
>>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>>> (ResourceImpl.java:1354)
>>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>>> (ResourceImpl.java:1155)
>>>> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
>>>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException:
>>>> Feature 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
>>>> (XMLHandler.java:1856)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
>>>> (XMLHandler.java:1820)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
>>>> (XMIHandler.java:149)
>>>> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
>>>> (XMLHandler.java:2570)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
>>>> (SAXXMIHandler.java:76)
>>>>
>>>> ....
>>>>
>>>>
>>>>
>>>> So, I have seen that the "val" feature that isn't found is an
>>>> inherited attribute. And If I remove all the inherited element from
>>>> my model It works.
>>>>
>>>>
>>>> I have also seen that the mapping generated by Teneo for a meta
>>>> model are not the same if the meta model come directly from my
>>>> ecore file or if it is a meta model persisted with Teneo.
>>>> With the same properties for the initialization of the hbdatastore
>>>> (inheritance mapping setted to SINGLE_TABLE), the subclasses are
>>>> not mapped in the same way :
>>>> - when the meta model come from the ecore file only one
>>>> table is
>>>> created for a class hierarchy as it is say on
>>>> http://www.elver.org/hibernate/inheritance.html
>>>>
>>>> - when the "same" meta model come from Teneo the mapping
>>>> create
>>>> also tables for the subclasses.
>>>>
>>>>
>>>> It is a problem for me because I have to do a models and meta
>>>> models repository, so I must be able to add/get/remove models
>>>> corresponding to meta models that are stored in Teneo (without the
>>>> ecore files containing the metamodels). But here the meta models
>>>> coming from file or coming from Teneo appears to not being
>>>> equivalent and it doesn't work...
>>>>
>>>> I'm trying to solve it from a long time but I con't find the
>>>> solution...
>>>>
>>>>
>>>> If anyone can help me, I will be very happy.
>>>>
>>>>
>>>>
>>>> Thanks,
>>>>
>>>>
>>>> Guillaume Doux
>>>>
>>>>
>>>>
>>>
>>
>
>


Re: [Teneo] Problems with inherited field - 1 attachment [message #609458 is a reply to message #93131] Fri, 10 August 2007 21:02 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090608060508000500000906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
I retested this and afaics it went fine (see the attached file, this one was read from the db). Your
debFromTeneo.ecore has a view strange sections:
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="ecore:EClass testdeb.ecore#/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="ecore:EClass testdeb.ecore#/1/Field"/>
</eClassifiers>

What I don't understand is where this: ecore:EClass testdeb.ecore#
comes from. In the ecore file, I created, the uri is: /1/Field.

My feeling is that this has something to do with the way you create the resource which reads the
debFromTeneo.ecore (btw, this may not be the problem but hides why it does not work for you).

Also my experience with reading epackages from the db or the filesystem is that it needs to be done
through a resourceset this ensures that the packages are placed in the EPackage registry and that
this registry is used during reading.

Btw, here is the simplified code I use to read the ecore, persist it and read it back. There are a
number of calls to convenience methods (store.beginTransaction etc.) but for the rest it is pretty
simple. This code does not use a resourceset (not required for the tests) but in production code you
should do this. You can try to replicate this simple approach and then check if the output is
incorrect or correct.

{
final Resource fileRes = new XMIResourceImpl();
fileRes.load(this.getClass().getResourceAsStream("debFile.ecore "), Collections.EMPTY_MAP);
store.beginTransaction();
for (Object o : fileRes.getContents()) {
store.store(o);
}
store.commitTransaction();
}
{
store.beginTransaction();
final Resource res = new XMIResourceImpl();
for (Object o : store.getObjects(EPackage.class)) {
res.getContents().add((EObject) o);
}
final OutputStream os = new FileOutputStream("/home/mtaal/mytmp/test.ecore");
res.save(os, Collections.EMPTY_MAP);
store.commitTransaction();
}

gr. Martin

guillaume wrote:
> Hi,
>
> It's the mapping corresponding to the EcorePackage,
>
> the part arround the EClassifier is :
>
>
> <subclass name="org.eclipse.emf.ecore.impl.EClassifierImpl" entity-
> name="EClassifier" abstract="true" lazy="false" extends="ENamedElement"
> discriminator-value="EClassifier">
> <meta attribute="eclassName">EClassifier</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore
> </meta>
> <property name="instanceClassName" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false"
> name="`instanceclassname`"/>
> </property>
> <property name="instanceTypeName" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false"
> name="`instancetypename`"/>
> </property>
> <many-to-one name="ePackage" entity-name="EPackage" lazy="false"
> insert="false" update="false" not-null="false">
> <column not-null="false" unique="false"
> name="`eclassifier_epackage_e_id`"/>
> </many-to-one>
> <list name="eTypeParameters" lazy="true" cascade="all,delete-
> orphan">
> <key update="true">
> <column name="`eclassifier_etypeparameters_e_id`" not-
> null="false" unique="false"/>
> </key>
> <list-index column="`eclassifier_etypeparameters_idx`"/>
> <one-to-many entity-name="ETypeParameter"/>
> </list>
> </subclass>
>
>
> I attach the complete mapping file.
>
>
> thanks,
>
>
>
> Guillaume.
>
>
> Martin Taal <mtaal@elver.org> wrote in
> news:f9hhot$si0$1@build.eclipse.org:
>
>> Hi,
>> and how does the hbm mapping of the ecore model itself look like?
>> Especially the part around EClassifier.
>>
>> gr. Martin
>>
>> guillaume wrote:
>>> Hi again,
>>>
>>> I attach the generated mapping for the meta-model coming from the
>>> ecore file (mappingWithModelFromEcoreFile.xml) , the mapping for the
>>> meta-model coming from Teneo (mappingWithModelFromTeneo.xml) , the
>>> serialized version of my meta-model coming from Teneo
>>> (debFromTeneo.ecore) and my original meta-model file (debFile.ecore).
>>>
>>> The difference between the 2 ecore file is that in my original meta
>>> model, the subclasses are represented like this :
>>> <eClassifiers xsi:type="ecore:EClass" name="Version"
>>> eSuperTypes="#/1/Field"/>
>>>
>>> and in the serialized form coming from Teneo, I have this :
>>> <eClassifiers xsi:type="ecore:EClass" name="Version">
>>> <eGenericSuperTypes eClassifier="ecore:EClass
>>> testdeb.ecore#/1/Field"/>
>>> </eClassifiers>
>>>
>>>
>>> Thanks,
>>>
>>>
>>> Guillaume
>>>
>>>
>>>
>>>
>>> Martin Taal <mtaal@elver.org> wrote in
>>> news:f9hdp5$kh2$1@build.eclipse.org:
>>>
>>>> Hi Guillaume,
>>>> If you encounter many problems then (imho) the best approach I can
>>>> think of is take a small model and analyze the differences between
>>>> the xml-serialization and the db-serialization (write the
>>>> db-serialized model to an xml file and do a text compare) and then
>>>> post these differences here in the newsgroup. I would use several
>>>> small models each one of them covering a limited set of more complex
>>>> part of your real-live models (for example one covering inheritance,
>>>> one other for several associations, one for enumerates, one for
>>>> edatatypes, etc.).
>>>>
>>>> Regarding your specific problem, it seems that the inheritance
>>>> relations between your eclasses is not persisted in the database.
>>>> Because of this: - the sub eclasses are stored in their own table
>>>> (as Teneo does not see a supertype) - the inherited features are not
>>>> visible in the subeclass (as the subeclass does not have a relation
>>>> anymore to its supertype).
>>>>
>>>> Can you check/post the hibernate mapping for the eSuperType and
>>>> eGenericSuperType feature of the eClass?
>>>>
>>>> gr. Martin
>>>>
>>>> guillaume wrote:
>>>>> Hi all,
>>>>>
>>>>> I'm always experiencing problem with Teneo.
>>>>>
>>>>> I have models that are conformed to a meta model.
>>>>>
>>>>> The problem is that when I try to deserialize the model from an
>>>>> ecore file, if I register the meta models packages from the meta
>>>>> models loaded from an ecore file it works fine and I can
>>>>> deserialize my model.
>>>>>
>>>>> But when I try to get my meta model from Teneo (assuming that the
>>>>> meta model getting from Teneo vas previously persisted by taking
>>>>> the meta model coming from the ecore file), I obtain an Exception :
>>>>>
>>>>> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
>>>>> 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors
>>>>> (XMLLoadImpl.java:81)
>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load
>>>>> (XMLLoadImpl.java:189)
>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad
>>>>> (XMLResourceImpl.java:180)
>>>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>>>> (ResourceImpl.java:1354)
>>>>> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load
>>>>> (ResourceImpl.java:1155)
>>>>> at test.TestStoreMetaModel.main(TestStoreMetaModel.java:131)
>>>>> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException:
>>>>> Feature 'val' not found. (file:///C:/eclipse-SDK-3.3-
>>>>> win32/workspace/TestPlugin/deb_res_thunderbird.ecore, 8, 106)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeatu re
>>>>> (XMLHandler.java:1856)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeatu re
>>>>> (XMLHandler.java:1820)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeatu re
>>>>> (XMIHandler.java:149)
>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue
>>>>> (XMLHandler.java:2570)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAtt ribs
>>>>> (SAXXMIHandler.java:76)
>>>>>
>>>>> ....
>>>>>
>>>>>
>>>>>
>>>>> So, I have seen that the "val" feature that isn't found is an
>>>>> inherited attribute. And If I remove all the inherited element from
>>>>> my model It works.
>>>>>
>>>>>
>>>>> I have also seen that the mapping generated by Teneo for a meta
>>>>> model are not the same if the meta model come directly from my
>>>>> ecore file or if it is a meta model persisted with Teneo.
>>>>> With the same properties for the initialization of the hbdatastore
>>>>> (inheritance mapping setted to SINGLE_TABLE), the subclasses are
>>>>> not mapped in the same way :
>>>>> - when the meta model come from the ecore file only one
>>>>> table is
>>>>> created for a class hierarchy as it is say on
>>>>> http://www.elver.org/hibernate/inheritance.html
>>>>>
>>>>> - when the "same" meta model come from Teneo the mapping
>>>>> create
>>>>> also tables for the subclasses.
>>>>>
>>>>>
>>>>> It is a problem for me because I have to do a models and meta
>>>>> models repository, so I must be able to add/get/remove models
>>>>> corresponding to meta models that are stored in Teneo (without the
>>>>> ecore files containing the metamodels). But here the meta models
>>>>> coming from file or coming from Teneo appears to not being
>>>>> equivalent and it doesn't work...
>>>>>
>>>>> I'm trying to solve it from a long time but I con't find the
>>>>> solution...
>>>>>
>>>>>
>>>>> If anyone can help me, I will be very happy.
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>>
>>>>> Guillaume Doux
>>>>>
>>>>>
>>>>>
>>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
>
> <!-- Generated by Teneo on Fri Aug 10 14:17:28 CEST 2007 -->
> <hibernate-mapping auto-import="false">
> <typedef name="ecore.EDiagnosticChain" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EDiagnosticChain</param>
> </typedef>
> <typedef name="ecore.EEList" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EEList</param>
> </typedef>
> <typedef name="ecore.EEnumerator" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EEnumerator</param>
> </typedef>
> <typedef name="ecore.EFeatureMap" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EFeatureMap</param>
> </typedef>
> <typedef name="ecore.EFeatureMapEntry" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EFeatureMapEntry</param>
> </typedef>
> <typedef name="ecore.EMap" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EMap</param>
> </typedef>
> <typedef name="ecore.EResource" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EResource</param>
> </typedef>
> <typedef name="ecore.EResourceSet" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">EResourceSet</param>
> </typedef>
> <typedef name="ecore.ETreeIterator" class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">
> <param name="epackage">http://www.eclipse.org/emf/2002/Ecore</param>
> <param name="edatatype">ETreeIterator</param>
> </typedef>
> <class name="org.eclipse.emf.ecore.impl.BasicEObjectImpl" entity-name="ecore_EObject" abstract="false" lazy="false" discriminator-value="ecore_EObject" table="`ecore_eobject`">
> <meta attribute="eclassName">EObject</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <id type="long" name="e_id" column="e_id" access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version" access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> </class>
> <subclass name="org.eclipse.emf.ecore.impl.EModelElementImpl" entity-name="EModelElement" abstract="true" lazy="false" extends="ecore_EObject" discriminator-value="EModelElement">
> <meta attribute="eclassName">EModelElement</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <list name="eAnnotations" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eannotation_emodelelement_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`emodelelement_eannotations_idx`"/>
> <one-to-many entity-name="EAnnotation"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.ENamedElementImpl" entity-name="ENamedElement" abstract="true" lazy="false" extends="EModelElement" discriminator-value="ENamedElement">
> <meta attribute="eclassName">ENamedElement</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="name" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.ETypedElementImpl" entity-name="ETypedElement" abstract="true" lazy="false" extends="ENamedElement" discriminator-value="ETypedElement">
> <meta attribute="eclassName">ETypedElement</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="ordered" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`ordered`"/>
> </property>
> <property name="unique" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`unique`"/>
> </property>
> <property name="lowerBound" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`lowerbound`"/>
> </property>
> <property name="upperBound" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`upperbound`"/>
> </property>
> <many-to-one name="eType" entity-name="EClassifier" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`eclassifier_etype_e_id`"/>
> </many-to-one>
> <many-to-one name="eGenericType" entity-name="EGenericType" cascade="all" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`egenerictype_egenerictype_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EStructuralFeatureImpl" entity-name="EStructuralFeature" abstract="true" lazy="false" extends="ETypedElement" discriminator-value="EStructuralFeature">
> <meta attribute="eclassName">EStructuralFeature</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="changeable" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`changeable`"/>
> </property>
> <property name="volatile" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`volatile`"/>
> </property>
> <property name="transient" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`transient`"/>
> </property>
> <property name="defaultValueLiteral" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`defaultvalueliteral`"/>
> </property>
> <property name="unsettable" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`unsettable`"/>
> </property>
> <property name="derived" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`derived`"/>
> </property>
> <many-to-one name="eContainingClass" entity-name="EClass" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`estructuralfeature_econtainingclass_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EAttributeImpl" entity-name="EAttribute" abstract="false" lazy="false" extends="EStructuralFeature" discriminator-value="EAttribute">
> <meta attribute="eclassName">EAttribute</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="iD" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`id`"/>
> </property>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EAnnotationImpl" entity-name="EAnnotation" abstract="false" lazy="false" extends="EModelElement" discriminator-value="EAnnotation">
> <meta attribute="eclassName">EAnnotation</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="source" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`source`"/>
> </property>
> <map name="details" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eannotation_details_e_id`" not-null="false" unique="false"/>
> </key>
> <map-key type="java.lang.String"/>
> <element type="java.lang.String"/>
> </map>
> <many-to-one name="eModelElement" entity-name="EModelElement" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eannotation_emodelelement_e_id`"/>
> </many-to-one>
> <list name="contents" table="`eannotation_contents`" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eannotation_e_id`" not-null="true" unique="false"/>
> </key>
> <list-index column="`eannotation_contents_idx`"/>
> <many-to-any id-type="long">
> <column not-null="true" unique="false" name="`contents_type`"/>
> <column not-null="true" unique="false" name="`contents_id`"/>
> </many-to-any>
> </list>
> <list name="references" table="`eannotation_references`" lazy="true">
> <key update="true">
> <column name="`eannotation_e_id`" not-null="true" unique="false"/>
> </key>
> <list-index column="`eannotation_references_idx`"/>
> <many-to-any id-type="long">
> <column not-null="true" unique="false" name="`references_type`"/>
> <column not-null="true" unique="false" name="`references_id`"/>
> </many-to-any>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EClassifierImpl" entity-name="EClassifier" abstract="true" lazy="false" extends="ENamedElement" discriminator-value="EClassifier">
> <meta attribute="eclassName">EClassifier</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="instanceClassName" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`instanceclassname`"/>
> </property>
> <property name="instanceTypeName" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`instancetypename`"/>
> </property>
> <many-to-one name="ePackage" entity-name="EPackage" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eclassifier_epackage_e_id`"/>
> </many-to-one>
> <list name="eTypeParameters" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eclassifier_etypeparameters_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclassifier_etypeparameters_idx`"/>
> <one-to-many entity-name="ETypeParameter"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EClassImpl" entity-name="EClass" abstract="false" lazy="false" extends="EClassifier" discriminator-value="EClass">
> <meta attribute="eclassName">EClass</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="abstract" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`abstract`"/>
> </property>
> <property name="interface" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`interface`"/>
> </property>
> <list name="eSuperTypes" lazy="true">
> <key update="true">
> <column name="`eclass_esupertypes_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclass_esupertypes_idx`"/>
> <one-to-many entity-name="EClass"/>
> </list>
> <list name="eOperations" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eoperation_econtainingclass_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclass_eoperations_idx`"/>
> <one-to-many entity-name="EOperation"/>
> </list>
> <list name="eStructuralFeatures" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`estructuralfeature_econtainingclass_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclass_estructuralfeatures_idx`"/>
> <one-to-many entity-name="EStructuralFeature"/>
> </list>
> <list name="eGenericSuperTypes" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eclass_egenericsupertypes_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eclass_egenericsupertypes_idx`"/>
> <one-to-many entity-name="EGenericType"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EDataTypeImpl" entity-name="EDataType" abstract="false" lazy="false" extends="EClassifier" discriminator-value="EDataType">
> <meta attribute="eclassName">EDataType</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="serializable" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`serializable`"/>
> </property>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EEnumImpl" entity-name="EEnum" abstract="false" lazy="false" extends="EDataType" discriminator-value="EEnum">
> <meta attribute="eclassName">EEnum</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <list name="eLiterals" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eenumliteral_eenum_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eenum_eliterals_idx`"/>
> <one-to-many entity-name="EEnumLiteral"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EEnumLiteralImpl" entity-name="EEnumLiteral" abstract="false" lazy="false" extends="ENamedElement" discriminator-value="EEnumLiteral">
> <meta attribute="eclassName">EEnumLiteral</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="value" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int">
> <column not-null="false" unique="false" name="`value`"/>
> </property>
> <property name="literal" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`literal`"/>
> </property>
> <many-to-one name="eEnum" entity-name="EEnum" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eenumliteral_eenum_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EFactoryImpl" entity-name="EFactory" abstract="false" lazy="false" extends="EModelElement" discriminator-value="EFactory">
> <meta attribute="eclassName">EFactory</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EOperationImpl" entity-name="EOperation" abstract="false" lazy="false" extends="ETypedElement" discriminator-value="EOperation">
> <meta attribute="eclassName">EOperation</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <many-to-one name="eContainingClass" entity-name="EClass" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eoperation_econtainingclass_e_id`"/>
> </many-to-one>
> <list name="eTypeParameters" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eoperation_etypeparameters_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eoperation_etypeparameters_idx`"/>
> <one-to-many entity-name="ETypeParameter"/>
> </list>
> <list name="eParameters" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eparameter_eoperation_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eoperation_eparameters_idx`"/>
> <one-to-many entity-name="EParameter"/>
> </list>
> <list name="eExceptions" lazy="true">
> <key update="true">
> <column name="`eoperation_eexceptions_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eoperation_eexceptions_idx`"/>
> <one-to-many entity-name="EClassifier"/>
> </list>
> <list name="eGenericExceptions" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eoperation_egenericexceptions_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`eoperation_egenericexceptions_idx`"/>
> <one-to-many entity-name="EGenericType"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EPackageImpl" entity-name="EPackage" abstract="false" lazy="false" extends="ENamedElement" discriminator-value="EPackage">
> <meta attribute="eclassName">EPackage</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="nsURI" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`nsuri`"/>
> </property>
> <property name="nsPrefix" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`nsprefix`"/>
> </property>
> <list name="eClassifiers" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`eclassifier_epackage_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`epackage_eclassifiers_idx`"/>
> <one-to-many entity-name="EClassifier"/>
> </list>
> <list name="eSubpackages" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`epackage_esuperpackage_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`epackage_esubpackages_idx`"/>
> <one-to-many entity-name="EPackage"/>
> </list>
> <many-to-one name="eSuperPackage" entity-name="EPackage" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`epackage_esuperpackage_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EParameterImpl" entity-name="EParameter" abstract="false" lazy="false" extends="ETypedElement" discriminator-value="EParameter">
> <meta attribute="eclassName">EParameter</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <many-to-one name="eOperation" entity-name="EOperation" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`eparameter_eoperation_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EReferenceImpl" entity-name="EReference" abstract="false" lazy="false" extends="EStructuralFeature" discriminator-value="EReference">
> <meta attribute="eclassName">EReference</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <property name="containment" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`containment`"/>
> </property>
> <property name="resolveProxies" lazy="false" insert="true" update="true" not-null="false" unique="false" type="boolean">
> <column not-null="false" unique="false" name="`resolveproxies`"/>
> </property>
> <many-to-one name="eOpposite" entity-name="EReference" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`ereference_eopposite_e_id`"/>
> </many-to-one>
> <list name="eKeys" lazy="true">
> <key update="true">
> <column name="`ereference_ekeys_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`ereference_ekeys_idx`"/>
> <one-to-many entity-name="EAttribute"/>
> </list>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.EGenericTypeImpl" entity-name="EGenericType" abstract="false" lazy="false" extends="ecore_EObject" discriminator-value="EGenericType">
> <meta attribute="eclassName">EGenericType</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <many-to-one name="eUpperBound" entity-name="EGenericType" cascade="all" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`egenerictype_eupperbound_e_id`"/>
> </many-to-one>
> <list name="eTypeArguments" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`egenerictype_etypearguments_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`egenerictype_etypearguments_idx`"/>
> <one-to-many entity-name="EGenericType"/>
> </list>
> <many-to-one name="eLowerBound" entity-name="EGenericType" cascade="all" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`egenerictype_elowerbound_e_id`"/>
> </many-to-one>
> <many-to-one name="eTypeParameter" entity-name="ETypeParameter" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`etypeparameter_etypeparameter_e_id`"/>
> </many-to-one>
> <many-to-one name="eClassifier" entity-name="EClassifier" lazy="false" insert="true" update="true" not-null="false">
> <column not-null="false" unique="false" name="`eclassifier_eclassifier_e_id`"/>
> </many-to-one>
> </subclass>
> <subclass name="org.eclipse.emf.ecore.impl.ETypeParameterImpl" entity-name="ETypeParameter" abstract="false" lazy="false" extends="ENamedElement" discriminator-value="ETypeParameter">
> <meta attribute="eclassName">ETypeParameter</meta>
> <meta attribute="epackage">http://www.eclipse.org/emf/2002/Ecore</meta>
> <list name="eBounds" lazy="true" cascade="all,delete-orphan">
> <key update="true">
> <column name="`etypeparameter_ebounds_e_id`" not-null="false" unique="false"/>
> </key>
> <list-index column="`etypeparameter_ebounds_idx`"/>
> <one-to-many entity-name="EGenericType"/>
> </list>
> </subclass>
> </hibernate-mapping>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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

--------------090608060508000500000906
Content-Type: text/xml;
name="deb_martin.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="deb_martin.ecore"

<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="int"/>
<eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
</ecore:EPackage>
<ecore:EPackage name="deb" nsURI="my.model.of.debian.package" nsPrefix="deb">
<eClassifiers xsi:type="ecore:EClass" name="Deb">
<eStructuralFeatures xsi:type="ecore:EReference" name="metadata" ordered="false" lowerBound="1" eType="/1/Databin" containment="true" eOpposite="/1/Databin/debpm"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="control" ordered="false" lowerBound="1" eType="/1/Archcontrol" containment="true" eOpposite="/1/Archcontrol/debc"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false" lowerBound="1" eType="/1/Archdata" containment="true" eOpposite="/1/Archdata/debd"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Databin">
<eStructuralFeatures xsi:type="ecore:EReference" name="debpm" ordered="false" lowerBound="1" eType="/1/Deb" eOpposite="/1/Deb/metadata"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false" upperBound="-1" eType="/1/Bloc" containment="true" eOpposite="/1/Bloc/meta"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bloc">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" ordered="false" lowerBound="1" eType="/1/Databin" eOpposite="/1/Databin/blocs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="field" ordered="false" upperBound="-1" eType="/1/Field" containment="true" eOpposite="/1/Field/blocs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Field" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="val" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocs" ordered="false" lowerBound="1" eType="/1/Bloc" eOpposite="/1/Bloc/field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Version">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_name">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script_descriptions">
<eGenericSuperTypes eClassifier="/1/Field"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archcontrol">
<eStructuralFeatures xsi:type="ecore:EReference" name="debc" ordered="false" lowerBound="1" eType="/1/Deb" eOpposite="/1/Deb/control"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scripts" ordered="false" upperBound="-1" eType="/1/Script" containment="true" eOpposite="/1/Script/archscript"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Script">
<eStructuralFeatures xsi:type="ecore:EReference" name="archscript" ordered="false" lowerBound="1" eType="/1/Archcontrol" eOpposite="/1/Archcontrol/scripts"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="script_name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Archdata">
<eStructuralFeatures xsi:type="ecore:EReference" name="debd" ordered="false" lowerBound="1" eType="/1/Deb" eOpposite="/1/Deb/data"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="fil" ordered="false" upperBound="-1" eType="/1/File" containment="true" eOpposite="/1/File/data"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EReference" name="data" ordered="false" lowerBound="1" eType="/1/Archdata" eOpposite="/1/Archdata/fil"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="filename" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------090608060508000500000906--
Re: [Teneo] Problems with inherited field [message #609462 is a reply to message #93196] Sat, 11 August 2007 09:06 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

Before send you the preceding message I have renamed the attached file,
the previous name debFromTeneo.ecore was testdeb.ecore...
But I did not know wy the name of the file is adding here.

I will try your code and tell you If it works...

Thanks,

Guillaume


Martin Taal a écrit :
> Hi,
> I retested this and afaics it went fine (see the attached file, this one
> was read from the db). Your debFromTeneo.ecore has a view strange sections:
> <eClassifiers xsi:type="ecore:EClass" name="Dependancy">
> <eGenericSuperTypes eClassifier="ecore:EClass
> testdeb.ecore#/1/Field"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
> <eGenericSuperTypes eClassifier="ecore:EClass
> testdeb.ecore#/1/Field"/>
> </eClassifiers>
>
> What I don't understand is where this: ecore:EClass testdeb.ecore#
> comes from. In the ecore file, I created, the uri is: /1/Field.
>
> My feeling is that this has something to do with the way you create the
> resource which reads the debFromTeneo.ecore (btw, this may not be the
> problem but hides why it does not work for you).
>
> Also my experience with reading epackages from the db or the filesystem
> is that it needs to be done through a resourceset this ensures that the
> packages are placed in the EPackage registry and that this registry is
> used during reading.
>
> Btw, here is the simplified code I use to read the ecore, persist it and
> read it back. There are a number of calls to convenience methods
> (store.beginTransaction etc.) but for the rest it is pretty simple. This
> code does not use a resourceset (not required for the tests) but in
> production code you should do this. You can try to replicate this simple
> approach and then check if the output is incorrect or correct.
>
> {
> final Resource fileRes = new XMIResourceImpl();
>
> fileRes.load(this.getClass().getResourceAsStream("debFile.ecore "),
> Collections.EMPTY_MAP);
> store.beginTransaction();
> for (Object o : fileRes.getContents()) {
> store.store(o);
> }
> store.commitTransaction();
> }
> {
> store.beginTransaction();
> final Resource res = new XMIResourceImpl();
> for (Object o : store.getObjects(EPackage.class)) {
> res.getContents().add((EObject) o);
> }
> final OutputStream os = new
> FileOutputStream("/home/mtaal/mytmp/test.ecore");
> res.save(os, Collections.EMPTY_MAP);
> store.commitTransaction();
> }
>
> gr. Martin
>
Re: [Teneo] Problems with inherited field [message #609466 is a reply to message #93257] Mon, 13 August 2007 18:02 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

I have try your code, it works fine :)

Once the "ecore:EClass myfile.ecore" removed from the file, all the
problems with the mapping are gone out...

It need more test to see if all works fine, but it seems to be...

thanks a lot !

Guillaume

guillaume a écrit :
> Hi,
>
> Before send you the preceding message I have renamed the attached file,
> the previous name debFromTeneo.ecore was testdeb.ecore...
> But I did not know wy the name of the file is adding here.
>
> I will try your code and tell you If it works...
>
> Thanks,
>
> Guillaume
>
>
> Martin Taal a écrit :
>> Hi,
>> I retested this and afaics it went fine (see the attached file, this
>> one was read from the db). Your debFromTeneo.ecore has a view strange
>> sections:
>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy">
>> <eGenericSuperTypes eClassifier="ecore:EClass
>> testdeb.ecore#/1/Field"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="package_descriptions">
>> <eGenericSuperTypes eClassifier="ecore:EClass
>> testdeb.ecore#/1/Field"/>
>> </eClassifiers>
>>
>> What I don't understand is where this: ecore:EClass testdeb.ecore#
>> comes from. In the ecore file, I created, the uri is: /1/Field.
>>
>> My feeling is that this has something to do with the way you create
>> the resource which reads the debFromTeneo.ecore (btw, this may not be
>> the problem but hides why it does not work for you).
>>
>> Also my experience with reading epackages from the db or the
>> filesystem is that it needs to be done through a resourceset this
>> ensures that the packages are placed in the EPackage registry and that
>> this registry is used during reading.
>>
>> Btw, here is the simplified code I use to read the ecore, persist it
>> and read it back. There are a number of calls to convenience methods
>> (store.beginTransaction etc.) but for the rest it is pretty simple.
>> This code does not use a resourceset (not required for the tests) but
>> in production code you should do this. You can try to replicate this
>> simple approach and then check if the output is incorrect or correct.
>>
>> {
>> final Resource fileRes = new XMIResourceImpl();
>>
>> fileRes.load(this.getClass().getResourceAsStream("debFile.ecore "),
>> Collections.EMPTY_MAP);
>> store.beginTransaction();
>> for (Object o : fileRes.getContents()) {
>> store.store(o);
>> }
>> store.commitTransaction();
>> }
>> {
>> store.beginTransaction();
>> final Resource res = new XMIResourceImpl();
>> for (Object o : store.getObjects(EPackage.class)) {
>> res.getContents().add((EObject) o);
>> }
>> final OutputStream os = new
>> FileOutputStream("/home/mtaal/mytmp/test.ecore");
>> res.save(os, Collections.EMPTY_MAP);
>> store.commitTransaction();
>> }
>>
>> gr. Martin
>>
Previous Topic:Backward compatibility: SET_FOREIGN_KEY_NAME to false
Next Topic:[Teneo] Turn off lazy-loading
Goto Forum:
  


Current Time: Fri Mar 29 12:12:28 GMT 2024

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

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

Back to the top