Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [TENEO] Problem of mapping when inheritance hierarchy in a stored metamodel
[TENEO] Problem of mapping when inheritance hierarchy in a stored metamodel [message #98343] |
Wed, 03 October 2007 12:19  |
Eclipse User |
|
|
|
Originally posted by: Hugo.Bruneliere.univ-nantes.fr
This is a multi-part message in MIME format.
--------------020504050102050807010706
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I'm having problems with models which conforms to metamodels containing
inheritance hierarchy.
The Debian metamodel and two sample models conforming to it are attached
to this post.
In a first execution, I store the metamodel and the two models using Teneo.
Then in a second execution, I try to reload these models (still using
Teneo) from the previously built database: I succeed in getting the
Debian metamodel and the "res_firefox" model but I fail in getting the
"res_thunderbird" model. The main difference between the two models is
that the second one uses instances of classes which inherit attributes
from another one. It seems to be the cause of the problem:
Exception in thread "main" org.hibernate.WrongClassException: Object
with id: 2 was not of the specified subclass: Field (Discriminator:
Dependancy)
at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
at
org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
at
org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
at
org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
at
org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
at
org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
at
org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
at
org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
at
org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
at
org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
at
org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
I took a look at the ecore_eobject table and the eclass_esupertypes_e_id
field does not seem to be correctly initiated for the concerned Eclass
of my Debian metamodel...
How can I configure the mapping (and my datastore) to work properly?
Thanks in advance,
Hugo
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
--------------020504050102050807010706
Content-Type: text/xml;
name="debian_res_thunderbird.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="debian_res_thunderbird.ecore"
<?xml version="1.0" encoding="ISO-8859-1"?>
<debian:Deb xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:debian="my.model.of.debian.package" name="thunderbird.deb">
<metadata>
<blocs>
<field xmi:type="debian:ScriptDescriptions" val="Nom du trigger" type="Script_descriptions"/>
<field xmi:type="debian:Dependancy" val="dependance" type="Dependancy"/>
<field xmi:type="debian:PackageName" val="thunderbird" type="name"/>
<field xmi:type="debian:PackageDescriptions" val="Description nom paquet" type="package_descriptions"/>
</blocs>
</metadata>
<control>
<scripts script_name="Nom du trigger" code="un script du paquet"/>
</control>
<data name="data.tar.gz">
<fil filename="libgtkembedmoz.so" location="/usr/lib/thunderbird"/>
<fil filename="bloaturls.txt" location="/usr/lib/thunderbird"/>
<fil filename="libgtkxtbin.so" location="/usr/lib/thunderbird"/>
<fil filename="libplds4.so" location="/usr/lib/thunderbird"/>
<fil filename="libbjsj.so" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-config" location="/usr/lib/thunderbird"/>
<fil filename="libplc4.so" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-bin" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird-rebuild-database" location="/usr/lib/thunderbird"/>
<fil filename="thunderbird" location="/usr/lib/thunderbird"/>
<fil filename="libnss3.so" location="/usr/lib/thunderbird"/>
<fil filename="elf-dynstr-gc" location="/usr/lib/thunderbird"/>
<fil filename="libnspr4.so" location="/usr/lib/thunderbird"/>
<fil filename="ligkgfx.so" location="/usr/lib/thunderbird"/>
<fil filename="ligtksuperwin.so" location="/usr/lib/thunderbird"/>
<fil filename="libmozjs.so" location="/usr/lib/thunderbird"/>
</data>
</debian:Deb>
--------------020504050102050807010706
Content-Type: text/xml;
name="Debian.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Debian.ecore"
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="Debian" nsURI="my.model.of.debian.package" nsPrefix="debian">
<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" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="PackageName" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="Dependancy" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions" eSuperTypes="#/1/Field"/>
<eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions" eSuperTypes="#/1/Field"/>
<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>
--------------020504050102050807010706
Content-Type: text/xml;
name="debian_res_firefox.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="debian_res_firefox.ecore"
<?xml version="1.0" encoding="ISO-8859-1"?>
<debian:Deb xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:debian="my.model.of.debian.package" name="firefox.deb">
<metadata>
<blocs>
</blocs>
</metadata>
<control>
<scripts script_name="Nom du trigger" code="un script du paquet"/>
</control>
<data name="data.tar.gz">
<fil filename="firefox-rebuild-database" location="/usr/lib/firefox"/>
<fil filename="bloaturls.txt" location="/usr/lib/firefox"/>
<fil filename="firefox-bin" location="/usr/lib/firefox"/>
<fil filename="elf-dynstr-gc" location="/usr/lib/firefox"/>
<fil filename="ligtksuperwin.so" location="/usr/lib/firefox"/>
<fil filename="libbjsj.so" location="/usr/lib/firefox"/>
<fil filename="libnss3.so" location="/usr/lib/firefox"/>
<fil filename="libmozjs.so" location="/usr/lib/firefox"/>
<fil filename="firefox" location="/usr/lib/firefox"/>
<fil filename="libnspr4.so" location="/usr/lib/firefox"/>
<fil filename="libgtkxtbin.so" location="/usr/lib/firefox"/>
<fil filename="libgtkembedmoz.so" location="/usr/lib/firefox"/>
<fil filename="firefox-config" location="/usr/lib/firefox"/>
<fil filename="ligkgfx.so" location="/usr/lib/firefox"/>
<fil filename="libplc4.so" location="/usr/lib/firefox"/>
<fil filename="libplds4.so" location="/usr/lib/firefox"/>
</data>
</debian:Deb>
--------------020504050102050807010706--
|
|
|
Re: [TENEO] Problem of mapping when inheritance hierarchy in a stored metamodel [message #98361 is a reply to message #98343] |
Wed, 03 October 2007 14:24   |
Eclipse User |
|
|
|
Hi Hugo,
This can occur if there are nameclashes.
For example assume a small hierarchy: type A inherits from B, and there are two other types C and D,
both have a list efeature called myRef, C refers to A and D refers to B. Assume that single-class
inheritance mapping is used (so inheritance structure is stored in one table) then A and B are both
stored in one table. Then when I create a C (with id=1) with myRef references to A then these
references are stored as values in the myRef column in the AB table. Then when I retrieve a D (by
accident also with id=1) from the database it will also look in the AB table to see if any
references should be loaded. If finds the previously stored A as this record has a column myRef with
value 1. It loads this A but fails because it expects B.
The above example could also occur here because it fails when loading a collection. You should set a
breakpoint in hibernate to check which exact instance is involved here and see which table fields
play a role. Based on that you (or I can help) can check which part of the model is the cause and
see if by adding annotations this can be solved.
gr. Martin
Hugo Bruneliere wrote:
> Hi,
>
> I'm having problems with models which conforms to metamodels containing
> inheritance hierarchy.
>
> The Debian metamodel and two sample models conforming to it are attached
> to this post.
>
> In a first execution, I store the metamodel and the two models using Teneo.
> Then in a second execution, I try to reload these models (still using
> Teneo) from the previously built database: I succeed in getting the
> Debian metamodel and the "res_firefox" model but I fail in getting the
> "res_thunderbird" model. The main difference between the two models is
> that the second one uses instances of classes which inherit attributes
> from another one. It seems to be the cause of the problem:
>
> Exception in thread "main" org.hibernate.WrongClassException: Object
> with id: 2 was not of the specified subclass: Field (Discriminator:
> Dependancy)
> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
> at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
> at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>
> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
> at
> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>
> at
> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>
> at
> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>
> at
> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>
> at
> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
> at
> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>
> at
> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>
> at
> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
> at
> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>
> at
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>
> at
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>
>
>
> I took a look at the ecore_eobject table and the eclass_esupertypes_e_id
> field does not seem to be correctly initiated for the concerned Eclass
> of my Debian metamodel...
>
>
> How can I configure the mapping (and my datastore) to work properly?
>
> Thanks in advance,
>
> Hugo
>
--
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] Problem of mapping when inheritance hierarchy in a stored metamodel [message #98583 is a reply to message #98564] |
Mon, 08 October 2007 09:39   |
Eclipse User |
|
|
|
Originally posted by: Hugo.Bruneliere.univ-nantes.fr
Hugo Bruneliere a écrit :
> Hi Martin,
>
> Martin Taal a écrit :
>> Hi Hugo,
>> This can occur if there are nameclashes.
>>
>> For example assume a small hierarchy: type A inherits from B, and
>> there are two other types C and D, both have a list efeature called
>> myRef, C refers to A and D refers to B. Assume that single-class
>> inheritance mapping is used (so inheritance structure is stored in one
>> table) then A and B are both stored in one table. Then when I create a
>> C (with id=1) with myRef references to A then these references are
>> stored as values in the myRef column in the AB table. Then when I
>> retrieve a D (by accident also with id=1) from the database it will
>> also look in the AB table to see if any references should be loaded.
>> If finds the previously stored A as this record has a column myRef
>> with value 1. It loads this A but fails because it expects B.
>>
>> The above example could also occur here because it fails when loading
>> a collection. You should set a breakpoint in hibernate to check which
>> exact instance is involved here and see which table fields play a
>> role. Based on that you (or I can help) can check which part of the
>> model is the cause and see if by adding annotations this can be solved.
>>
>
> The problem seems to come from the mapping for the Debian metamodel
> (i.e. epackage) which is not correctly generated by Teneo: only the
> "ScriptDescriptions" class is well declared as a subclass of the "Field"
> one, whereas in the metamodel the
> "PackageDescriptions","Dependancy","PackageName" and "Version" classes
> are also subclasses of this one.
>
> This explains why it fails when trying to get from the database an
> instance of "PackageDescriptions","Dependancy","PackageName" or
> "Version" classes.
>
> I attached the Debian metamodel and the mapping file.
>
> Do you see why in this case the mapping is incomplete?
What is strange is that the mapping generated by the first execution of
the test program (i.e. when adding the "debian_res_thunderbird" model to
the database) is good.
But during the second execution of it (i.e. when trying to retrieve the
"debian_res_thunderbird" model from the database), the mapping contains
the previously described errors. However, when I try to retrieve the
"Debian" metamodel (i.e. the "Debian" epackage) and to serialize it, it
works well (the Ecore file describes the right inheritance tree) ?!?
>
> Best regards,
>
> Hugo
>
>> gr. Martin
>>
>> Hugo Bruneliere wrote:
>>> Hi,
>>>
>>> I'm having problems with models which conforms to metamodels
>>> containing inheritance hierarchy.
>>>
>>> The Debian metamodel and two sample models conforming to it are
>>> attached to this post.
>>>
>>> In a first execution, I store the metamodel and the two models using
>>> Teneo.
>>> Then in a second execution, I try to reload these models (still using
>>> Teneo) from the previously built database: I succeed in getting the
>>> Debian metamodel and the "res_firefox" model but I fail in getting
>>> the "res_thunderbird" model. The main difference between the two
>>> models is that the second one uses instances of classes which inherit
>>> attributes from another one. It seems to be the cause of the problem:
>>>
>>> Exception in thread "main" org.hibernate.WrongClassException: Object
>>> with id: 2 was not of the specified subclass: Field (Discriminator:
>>> Dependancy)
>>> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>> at
>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>> at
>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>
>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>> at
>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>
>>> at
>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>
>>> at
>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>
>>> at
>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>
>>> at
>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>> at
>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>
>>> at
>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>
>>> at
>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>
>>> at
>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>
>>> at
>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>
>>> at
>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>
>>> at
>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>
>>>
>>>
>>> I took a look at the ecore_eobject table and the
>>> eclass_esupertypes_e_id field does not seem to be correctly initiated
>>> for the concerned Eclass of my Debian metamodel...
>>>
>>>
>>> How can I configure the mapping (and my datastore) to work properly?
>>>
>>> Thanks in advance,
>>>
>>> Hugo
>>>
>>
>>
>
>
>
> ------------------------------------------------------------ ------------
>
> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
> <hibernate-mapping auto-import="false">
> <class entity-name="debian.Deb" abstract="false" lazy="false" discriminator-value="debian.Deb" table="`debian_deb`">
> <meta attribute="eclassName">Deb</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="metadata" entity-name="debian.Databin" cascade="all" foreign-key="debian_deb_metadata" lazy="false" insert="true" update="true" unique="true"/>
> <one-to-one name="control" entity-name="debian.Archcontrol" foreign-key="debian_deb_control" cascade="all" property-ref="debc" lazy="false"/>
> <one-to-one name="data" entity-name="debian.Archdata" foreign-key="debian_deb_data" cascade="all" property-ref="debd" lazy="false"/>
> <property name="name" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`name`"/>
> </property>
> </class>
> <class entity-name="debian.Databin" abstract="false" lazy="false" discriminator-value="debian.Databin" table="`debian_databin`">
> <meta attribute="eclassName">Databin</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <one-to-one name="debpm" entity-name="debian.Deb" foreign-key="debian_databin_debpm" cascade="merge,persist,save-update,lock,refresh" property-ref="metadata" lazy="false"/>
> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="debian_databin_blocs">
> <column name="`bloc_meta_e_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="debian.Bloc"/>
> </bag>
> </class>
> <class entity-name="debian.Bloc" abstract="false" lazy="false" discriminator-value="debian.Bloc" table="`debian_bloc`">
> <meta attribute="eclassName">Bloc</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="meta" entity-name="debian.Databin" foreign-key="debian_bloc_meta" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`bloc_meta_e_id`"/>
> </many-to-one>
> <bag name="field" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="debian_bloc_field">
> <column name="`field_blocs_e_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="debian.Field"/>
> </bag>
> </class>
> <class entity-name="debian.Field" abstract="true" lazy="false" discriminator-value="debian.Field" table="`debian_field`">
> <meta attribute="eclassName">Field</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <property name="val" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`val`"/>
> </property>
> <property name="type" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`type`"/>
> </property>
> <many-to-one name="blocs" entity-name="debian.Bloc" foreign-key="debian_field_blocs" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`field_blocs_e_id`"/>
> </many-to-one>
> </class>
> <class entity-name="debian.Version" abstract="false" lazy="false" discriminator-value="debian.Version" table="`debian_version`">
> <meta attribute="eclassName">Version</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <class entity-name="debian.PackageName" abstract="false" lazy="false" discriminator-value="debian.PackageName" table="`debian_packagename`">
> <meta attribute="eclassName">PackageName</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <class entity-name="debian.Dependancy" abstract="false" lazy="false" discriminator-value="debian.Dependancy" table="`debian_dependancy`">
> <meta attribute="eclassName">Dependancy</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <class entity-name="debian.PackageDescriptions" abstract="false" lazy="false" discriminator-value="debian.PackageDescriptions" table="`debian_packagedescriptions`">
> <meta attribute="eclassName">PackageDescriptions</meta>
> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions" abstract="false" lazy="false" extends="debian.Field" discriminator-value="debian.ScriptDescriptions">
> <meta attribute="eclassName">ScriptDescriptions</meta>
> <meta attribute="epackage">my.model.of.debian.package</meta>
> </subclass>
> <class entity-name="debian.Archcontrol" abstract="false" lazy="false" discriminator-value="debian.Archcontrol" table="`debian_archcontrol`">
> <meta attribute="eclassName">Archcontrol</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="debc" entity-name="debian.Deb" cascade="merge,persist,save-update,lock,refresh" foreign-key="debian_archcontrol_debc" lazy="false" insert="true" update="true" unique="true"/>
> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="debian_archcontrol_scripts">
> <column name="`script_archscript_e_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="debian.Script"/>
> </bag>
> </class>
> <class entity-name="debian.Script" abstract="false" lazy="false" discriminator-value="debian.Script" table="`debian_script`">
> <meta attribute="eclassName">Script</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="archscript" entity-name="debian.Archcontrol" foreign-key="debian_script_archscript" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`script_archscript_e_id`"/>
> </many-to-one>
> <property name="script_name" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`script_name`"/>
> </property>
> <property name="code" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`code`"/>
> </property>
> </class>
> <class entity-name="debian.Archdata" abstract="false" lazy="false" discriminator-value="debian.Archdata" table="`debian_archdata`">
> <meta attribute="eclassName">Archdata</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="debd" entity-name="debian.Deb" cascade="merge,persist,save-update,lock,refresh" foreign-key="debian_archdata_debd" lazy="false" insert="true" update="true" unique="true"/>
> <bag name="fil" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="debian_archdata_fil">
> <column name="`file_data_e_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="debian.File"/>
> </bag>
> <property name="name" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`name`"/>
> </property>
> </class>
> <class entity-name="debian.File" abstract="false" lazy="false" discriminator-value="debian.File" table="`debian_file`">
> <meta attribute="eclassName">File</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="data" entity-name="debian.Archdata" foreign-key="debian_file_data" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`file_data_e_id`"/>
> </many-to-one>
> <property name="filename" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`filename`"/>
> </property>
> <property name="location" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`location`"/>
> </property>
> </class>
> </hibernate-mapping>
>
>
> ------------------------------------------------------------ ------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <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="Debian" nsURI="my.model.of.debian.package" nsPrefix="debian">
> <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" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="PackageName" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="Dependancy" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions" eSuperTypes="#/1/Field"/>
> <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>
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Re: [TENEO] Problem of mapping when inheritance hierarchy in a stored metamodel [message #98627 is a reply to message #98583] |
Mon, 08 October 2007 11:02   |
Eclipse User |
|
|
|
Hi Hugo,
I tried it and yes the debian.ecore maps correctly. For my understanding what you do is persist the
debian.ecore itself also in the db then retrieve it and then use this retrieved debian model to
create a hibernate mapping. Am I correct?
And this retrieved model does not contain the correct sub-type super-type relations.
gr. Martin
Hugo Bruneliere wrote:
> Hugo Bruneliere a écrit :
>> Hi Martin,
>>
>> Martin Taal a écrit :
>>> Hi Hugo,
>>> This can occur if there are nameclashes.
>>>
>>> For example assume a small hierarchy: type A inherits from B, and
>>> there are two other types C and D, both have a list efeature called
>>> myRef, C refers to A and D refers to B. Assume that single-class
>>> inheritance mapping is used (so inheritance structure is stored in
>>> one table) then A and B are both stored in one table. Then when I
>>> create a C (with id=1) with myRef references to A then these
>>> references are stored as values in the myRef column in the AB table.
>>> Then when I retrieve a D (by accident also with id=1) from the
>>> database it will also look in the AB table to see if any references
>>> should be loaded. If finds the previously stored A as this record has
>>> a column myRef with value 1. It loads this A but fails because it
>>> expects B.
>>>
>>> The above example could also occur here because it fails when loading
>>> a collection. You should set a breakpoint in hibernate to check which
>>> exact instance is involved here and see which table fields play a
>>> role. Based on that you (or I can help) can check which part of the
>>> model is the cause and see if by adding annotations this can be solved.
>>>
>>
>> The problem seems to come from the mapping for the Debian metamodel
>> (i.e. epackage) which is not correctly generated by Teneo: only the
>> "ScriptDescriptions" class is well declared as a subclass of the
>> "Field" one, whereas in the metamodel the
>> "PackageDescriptions","Dependancy","PackageName" and "Version" classes
>> are also subclasses of this one.
>>
>> This explains why it fails when trying to get from the database an
>> instance of "PackageDescriptions","Dependancy","PackageName" or
>> "Version" classes.
>>
>> I attached the Debian metamodel and the mapping file.
>>
>> Do you see why in this case the mapping is incomplete?
>
> What is strange is that the mapping generated by the first execution of
> the test program (i.e. when adding the "debian_res_thunderbird" model to
> the database) is good.
>
> But during the second execution of it (i.e. when trying to retrieve the
> "debian_res_thunderbird" model from the database), the mapping contains
> the previously described errors. However, when I try to retrieve the
> "Debian" metamodel (i.e. the "Debian" epackage) and to serialize it, it
> works well (the Ecore file describes the right inheritance tree) ?!?
>
>>
>> Best regards,
>>
>> Hugo
>>
>>> gr. Martin
>>>
>>> Hugo Bruneliere wrote:
>>>> Hi,
>>>>
>>>> I'm having problems with models which conforms to metamodels
>>>> containing inheritance hierarchy.
>>>>
>>>> The Debian metamodel and two sample models conforming to it are
>>>> attached to this post.
>>>>
>>>> In a first execution, I store the metamodel and the two models using
>>>> Teneo.
>>>> Then in a second execution, I try to reload these models (still
>>>> using Teneo) from the previously built database: I succeed in
>>>> getting the Debian metamodel and the "res_firefox" model but I fail
>>>> in getting the "res_thunderbird" model. The main difference between
>>>> the two models is that the second one uses instances of classes
>>>> which inherit attributes from another one. It seems to be the cause
>>>> of the problem:
>>>>
>>>> Exception in thread "main" org.hibernate.WrongClassException: Object
>>>> with id: 2 was not of the specified subclass: Field (Discriminator:
>>>> Dependancy)
>>>> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>>> at
>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>>> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>>> at
>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>>
>>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>>> at
>>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>>
>>>> at
>>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>>
>>>> at
>>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>>
>>>> at
>>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>>
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>>
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>
>>>> at
>>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>>
>>>> at
>>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>>
>>>>
>>>>
>>>> I took a look at the ecore_eobject table and the
>>>> eclass_esupertypes_e_id field does not seem to be correctly
>>>> initiated for the concerned Eclass of my Debian metamodel...
>>>>
>>>>
>>>> How can I configure the mapping (and my datastore) to work properly?
>>>>
>>>> Thanks in advance,
>>>>
>>>> Hugo
>>>>
>>>
>>>
>>
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
>> <hibernate-mapping auto-import="false">
>> <class entity-name="debian.Deb" abstract="false" lazy="false"
>> discriminator-value="debian.Deb" table="`debian_deb`">
>> <meta attribute="eclassName">Deb</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="metadata" entity-name="debian.Databin"
>> cascade="all" foreign-key="debian_deb_metadata" lazy="false"
>> insert="true" update="true" unique="true"/>
>> <one-to-one name="control" entity-name="debian.Archcontrol"
>> foreign-key="debian_deb_control" cascade="all" property-ref="debc"
>> lazy="false"/>
>> <one-to-one name="data" entity-name="debian.Archdata"
>> foreign-key="debian_deb_data" cascade="all" property-ref="debd"
>> lazy="false"/>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`name`"/>
>> </property>
>> </class>
>> <class entity-name="debian.Databin" abstract="false" lazy="false"
>> discriminator-value="debian.Databin" table="`debian_databin`">
>> <meta attribute="eclassName">Databin</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <one-to-one name="debpm" entity-name="debian.Deb"
>> foreign-key="debian_databin_debpm"
>> cascade="merge,persist,save-update,lock,refresh"
>> property-ref="metadata" lazy="false"/>
>> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="debian_databin_blocs">
>> <column name="`bloc_meta_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <one-to-many entity-name="debian.Bloc"/>
>> </bag>
>> </class>
>> <class entity-name="debian.Bloc" abstract="false" lazy="false"
>> discriminator-value="debian.Bloc" table="`debian_bloc`">
>> <meta attribute="eclassName">Bloc</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="meta" entity-name="debian.Databin"
>> foreign-key="debian_bloc_meta" lazy="false" insert="false"
>> update="false" not-null="false">
>> <column not-null="false" unique="false"
>> name="`bloc_meta_e_id`"/>
>> </many-to-one>
>> <bag name="field" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="debian_bloc_field">
>> <column name="`field_blocs_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <one-to-many entity-name="debian.Field"/>
>> </bag>
>> </class>
>> <class entity-name="debian.Field" abstract="true" lazy="false"
>> discriminator-value="debian.Field" table="`debian_field`">
>> <meta attribute="eclassName">Field</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <property name="val" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`val`"/>
>> </property>
>> <property name="type" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`type`"/>
>> </property>
>> <many-to-one name="blocs" entity-name="debian.Bloc"
>> foreign-key="debian_field_blocs" lazy="false" insert="false"
>> update="false" not-null="false">
>> <column not-null="false" unique="false"
>> name="`field_blocs_e_id`"/>
>> </many-to-one>
>> </class>
>> <class entity-name="debian.Version" abstract="false" lazy="false"
>> discriminator-value="debian.Version" table="`debian_version`">
>> <meta attribute="eclassName">Version</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <class entity-name="debian.PackageName" abstract="false"
>> lazy="false" discriminator-value="debian.PackageName"
>> table="`debian_packagename`">
>> <meta attribute="eclassName">PackageName</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <class entity-name="debian.Dependancy" abstract="false"
>> lazy="false" discriminator-value="debian.Dependancy"
>> table="`debian_dependancy`">
>> <meta attribute="eclassName">Dependancy</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <class entity-name="debian.PackageDescriptions" abstract="false"
>> lazy="false" discriminator-value="debian.PackageDescriptions"
>> table="`debian_packagedescriptions`">
>> <meta attribute="eclassName">PackageDescriptions</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions" abstract="false"
>> lazy="false" extends="debian.Field"
>> discriminator-value="debian.ScriptDescriptions">
>> <meta attribute="eclassName">ScriptDescriptions</meta>
>> <meta attribute="epackage">my.model.of.debian.package</meta>
>> </subclass>
>> <class entity-name="debian.Archcontrol" abstract="false"
>> lazy="false" discriminator-value="debian.Archcontrol"
>> table="`debian_archcontrol`">
>> <meta attribute="eclassName">Archcontrol</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="debc" entity-name="debian.Deb"
>> cascade="merge,persist,save-update,lock,refresh"
>> foreign-key="debian_archcontrol_debc" lazy="false" insert="true"
>> update="true" unique="true"/>
>> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="debian_archcontrol_scripts">
>> <column name="`script_archscript_e_id`"
>> not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="debian.Script"/>
>> </bag>
>> </class>
>> <class entity-name="debian.Script" abstract="false" lazy="false"
>> discriminator-value="debian.Script" table="`debian_script`">
>> <meta attribute="eclassName">Script</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="archscript"
>> entity-name="debian.Archcontrol"
>> foreign-key="debian_script_archscript" lazy="false" insert="false"
>> update="false" not-null="false">
>> <column not-null="false" unique="false"
>> name="`script_archscript_e_id`"/>
>> </many-to-one>
>> <property name="script_name" lazy="false" insert="true"
>> update="true" not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`script_name`"/>
>> </property>
>> <property name="code" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`code`"/>
>> </property>
>> </class>
>> <class entity-name="debian.Archdata" abstract="false" lazy="false"
>> discriminator-value="debian.Archdata" table="`debian_archdata`">
>> <meta attribute="eclassName">Archdata</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="debd" entity-name="debian.Deb"
>> cascade="merge,persist,save-update,lock,refresh"
>> foreign-key="debian_archdata_debd" lazy="false" insert="true"
>> update="true" unique="true"/>
>> <bag name="fil" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="debian_archdata_fil">
>> <column name="`file_data_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <one-to-many entity-name="debian.File"/>
>> </bag>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`name`"/>
>> </property>
>> </class>
>> <class entity-name="debian.File" abstract="false" lazy="false"
>> discriminator-value="debian.File" table="`debian_file`">
>> <meta attribute="eclassName">File</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="data" entity-name="debian.Archdata"
>> foreign-key="debian_file_data" lazy="false" insert="false"
>> update="false" not-null="false">
>> <column not-null="false" unique="false"
>> name="`file_data_e_id`"/>
>> </many-to-one>
>> <property name="filename" lazy="false" insert="true"
>> update="true" not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`filename`"/>
>> </property>
>> <property name="location" lazy="false" insert="true"
>> update="true" not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`location`"/>
>> </property>
>> </class>
>> </hibernate-mapping>
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <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="Debian" nsURI="my.model.of.debian.package"
>> nsPrefix="debian">
>> <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"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="PackageName"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions"
>> eSuperTypes="#/1/Field"/>
>> <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>
>
>
--
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] Problem of mapping when inheritance hierarchy in a stored metamodel [message #98662 is a reply to message #98627] |
Mon, 08 October 2007 12:09   |
Eclipse User |
|
|
|
Originally posted by: Hugo.Bruneliere.univ-nantes.fr
Martin Taal a écrit :
> Hi Hugo,
> I tried it and yes the debian.ecore maps correctly. For my understanding
> what you do is persist the debian.ecore itself also in the db then
> retrieve it and then use this retrieved debian model to create a
> hibernate mapping. Am I correct?
> And this retrieved model does not contain the correct sub-type
> super-type relations.
Yes that's it. But what is strange is that when I serialize the debian
model I retrieved, I obtain the same debian.ecore file as the original
one. I can deduce that the debian.ecore model is well-stored and
well-retrieved (with the right inheritance tree).
After that I create a new hibernate data store in which I set the
retrieved Debian EPackage in order to be able to create Debian models.
But why does the mapping differ this time?
Hugo
>
> gr. Martin
>
> Hugo Bruneliere wrote:
>> Hugo Bruneliere a écrit :
>>> Hi Martin,
>>>
>>> Martin Taal a écrit :
>>>> Hi Hugo,
>>>> This can occur if there are nameclashes.
>>>>
>>>> For example assume a small hierarchy: type A inherits from B, and
>>>> there are two other types C and D, both have a list efeature called
>>>> myRef, C refers to A and D refers to B. Assume that single-class
>>>> inheritance mapping is used (so inheritance structure is stored in
>>>> one table) then A and B are both stored in one table. Then when I
>>>> create a C (with id=1) with myRef references to A then these
>>>> references are stored as values in the myRef column in the AB table.
>>>> Then when I retrieve a D (by accident also with id=1) from the
>>>> database it will also look in the AB table to see if any references
>>>> should be loaded. If finds the previously stored A as this record
>>>> has a column myRef with value 1. It loads this A but fails because
>>>> it expects B.
>>>>
>>>> The above example could also occur here because it fails when
>>>> loading a collection. You should set a breakpoint in hibernate to
>>>> check which exact instance is involved here and see which table
>>>> fields play a role. Based on that you (or I can help) can check
>>>> which part of the model is the cause and see if by adding
>>>> annotations this can be solved.
>>>>
>>>
>>> The problem seems to come from the mapping for the Debian metamodel
>>> (i.e. epackage) which is not correctly generated by Teneo: only the
>>> "ScriptDescriptions" class is well declared as a subclass of the
>>> "Field" one, whereas in the metamodel the
>>> "PackageDescriptions","Dependancy","PackageName" and "Version"
>>> classes are also subclasses of this one.
>>>
>>> This explains why it fails when trying to get from the database an
>>> instance of "PackageDescriptions","Dependancy","PackageName" or
>>> "Version" classes.
>>>
>>> I attached the Debian metamodel and the mapping file.
>>>
>>> Do you see why in this case the mapping is incomplete?
>>
>> What is strange is that the mapping generated by the first execution
>> of the test program (i.e. when adding the "debian_res_thunderbird"
>> model to the database) is good.
>>
>> But during the second execution of it (i.e. when trying to retrieve
>> the "debian_res_thunderbird" model from the database), the mapping
>> contains the previously described errors. However, when I try to
>> retrieve the "Debian" metamodel (i.e. the "Debian" epackage) and to
>> serialize it, it works well (the Ecore file describes the right
>> inheritance tree) ?!?
>>
>>>
>>> Best regards,
>>>
>>> Hugo
>>>
>>>> gr. Martin
>>>>
>>>> Hugo Bruneliere wrote:
>>>>> Hi,
>>>>>
>>>>> I'm having problems with models which conforms to metamodels
>>>>> containing inheritance hierarchy.
>>>>>
>>>>> The Debian metamodel and two sample models conforming to it are
>>>>> attached to this post.
>>>>>
>>>>> In a first execution, I store the metamodel and the two models
>>>>> using Teneo.
>>>>> Then in a second execution, I try to reload these models (still
>>>>> using Teneo) from the previously built database: I succeed in
>>>>> getting the Debian metamodel and the "res_firefox" model but I fail
>>>>> in getting the "res_thunderbird" model. The main difference between
>>>>> the two models is that the second one uses instances of classes
>>>>> which inherit attributes from another one. It seems to be the cause
>>>>> of the problem:
>>>>>
>>>>> Exception in thread "main" org.hibernate.WrongClassException:
>>>>> Object with id: 2 was not of the specified subclass: Field
>>>>> (Discriminator: Dependancy)
>>>>> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>>>> at
>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>>>> at
>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>>>> at
>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>>>
>>>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>>>> at
>>>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>>>
>>>>> at
>>>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>>>
>>>>> at
>>>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>>>
>>>>> at
>>>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>>>
>>>>> at
>>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>>>
>>>>> at
>>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>>
>>>>> at
>>>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>>>
>>>>>
>>>>>
>>>>> I took a look at the ecore_eobject table and the
>>>>> eclass_esupertypes_e_id field does not seem to be correctly
>>>>> initiated for the concerned Eclass of my Debian metamodel...
>>>>>
>>>>>
>>>>> How can I configure the mapping (and my datastore) to work properly?
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Hugo
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
>>> <hibernate-mapping auto-import="false">
>>> <class entity-name="debian.Deb" abstract="false" lazy="false"
>>> discriminator-value="debian.Deb" table="`debian_deb`">
>>> <meta attribute="eclassName">Deb</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="metadata" entity-name="debian.Databin"
>>> cascade="all" foreign-key="debian_deb_metadata" lazy="false"
>>> insert="true" update="true" unique="true"/>
>>> <one-to-one name="control" entity-name="debian.Archcontrol"
>>> foreign-key="debian_deb_control" cascade="all" property-ref="debc"
>>> lazy="false"/>
>>> <one-to-one name="data" entity-name="debian.Archdata"
>>> foreign-key="debian_deb_data" cascade="all" property-ref="debd"
>>> lazy="false"/>
>>> <property name="name" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`name`"/>
>>> </property>
>>> </class>
>>> <class entity-name="debian.Databin" abstract="false" lazy="false"
>>> discriminator-value="debian.Databin" table="`debian_databin`">
>>> <meta attribute="eclassName">Databin</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <one-to-one name="debpm" entity-name="debian.Deb"
>>> foreign-key="debian_databin_debpm"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> property-ref="metadata" lazy="false"/>
>>> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="debian_databin_blocs">
>>> <column name="`bloc_meta_e_id`" not-null="false"
>>> unique="false"/>
>>> </key>
>>> <one-to-many entity-name="debian.Bloc"/>
>>> </bag>
>>> </class>
>>> <class entity-name="debian.Bloc" abstract="false" lazy="false"
>>> discriminator-value="debian.Bloc" table="`debian_bloc`">
>>> <meta attribute="eclassName">Bloc</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="meta" entity-name="debian.Databin"
>>> foreign-key="debian_bloc_meta" lazy="false" insert="false"
>>> update="false" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`bloc_meta_e_id`"/>
>>> </many-to-one>
>>> <bag name="field" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="debian_bloc_field">
>>> <column name="`field_blocs_e_id`" not-null="false"
>>> unique="false"/>
>>> </key>
>>> <one-to-many entity-name="debian.Field"/>
>>> </bag>
>>> </class>
>>> <class entity-name="debian.Field" abstract="true" lazy="false"
>>> discriminator-value="debian.Field" table="`debian_field`">
>>> <meta attribute="eclassName">Field</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <property name="val" lazy="false" insert="true" update="true"
>>> not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`val`"/>
>>> </property>
>>> <property name="type" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`type`"/>
>>> </property>
>>> <many-to-one name="blocs" entity-name="debian.Bloc"
>>> foreign-key="debian_field_blocs" lazy="false" insert="false"
>>> update="false" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`field_blocs_e_id`"/>
>>> </many-to-one>
>>> </class>
>>> <class entity-name="debian.Version" abstract="false" lazy="false"
>>> discriminator-value="debian.Version" table="`debian_version`">
>>> <meta attribute="eclassName">Version</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <class entity-name="debian.PackageName" abstract="false"
>>> lazy="false" discriminator-value="debian.PackageName"
>>> table="`debian_packagename`">
>>> <meta attribute="eclassName">PackageName</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <class entity-name="debian.Dependancy" abstract="false"
>>> lazy="false" discriminator-value="debian.Dependancy"
>>> table="`debian_dependancy`">
>>> <meta attribute="eclassName">Dependancy</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <class entity-name="debian.PackageDescriptions" abstract="false"
>>> lazy="false" discriminator-value="debian.PackageDescriptions"
>>> table="`debian_packagedescriptions`">
>>> <meta attribute="eclassName">PackageDescriptions</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions"
>>> abstract="false" lazy="false" extends="debian.Field"
>>> discriminator-value="debian.ScriptDescriptions">
>>> <meta attribute="eclassName">ScriptDescriptions</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</meta>
>>> </subclass>
>>> <class entity-name="debian.Archcontrol" abstract="false"
>>> lazy="false" discriminator-value="debian.Archcontrol"
>>> table="`debian_archcontrol`">
>>> <meta attribute="eclassName">Archcontrol</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="debc" entity-name="debian.Deb"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> foreign-key="debian_archcontrol_debc" lazy="false" insert="true"
>>> update="true" unique="true"/>
>>> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="debian_archcontrol_scripts">
>>> <column name="`script_archscript_e_id`"
>>> not-null="false" unique="false"/>
>>> </key>
>>> <one-to-many entity-name="debian.Script"/>
>>> </bag>
>>> </class>
>>> <class entity-name="debian.Script" abstract="false" lazy="false"
>>> discriminator-value="debian.Script" table="`debian_script`">
>>> <meta attribute="eclassName">Script</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="archscript"
>>> entity-name="debian.Archcontrol"
>>> foreign-key="debian_script_archscript" lazy="false" insert="false"
>>> update="false" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`script_archscript_e_id`"/>
>>> </many-to-one>
>>> <property name="script_name" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false"
>>> name="`script_name`"/>
>>> </property>
>>> <property name="code" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`code`"/>
>>> </property>
>>> </class>
>>> <class entity-name="debian.Archdata" abstract="false"
>>> lazy="false" discriminator-value="debian.Archdata"
>>> table="`debian_archdata`">
>>> <meta attribute="eclassName">Archdata</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="debd" entity-name="debian.Deb"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> foreign-key="debian_archdata_debd" lazy="false" insert="true"
>>> update="true" unique="true"/>
>>> <bag name="fil" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="debian_archdata_fil">
>>> <column name="`file_data_e_id`" not-null="false"
>>> unique="false"/>
>>> </key>
>>> <one-to-many entity-name="debian.File"/>
>>> </bag>
>>> <property name="name" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`name`"/>
>>> </property>
>>> </class>
>>> <class entity-name="debian.File" abstract="false" lazy="false"
>>> discriminator-value="debian.File" table="`debian_file`">
>>> <meta attribute="eclassName">File</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="data" entity-name="debian.Archdata"
>>> foreign-key="debian_file_data" lazy="false" insert="false"
>>> update="false" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`file_data_e_id`"/>
>>> </many-to-one>
>>> <property name="filename" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`filename`"/>
>>> </property>
>>> <property name="location" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`location`"/>
>>> </property>
>>> </class>
>>> </hibernate-mapping>
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <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="Debian" nsURI="my.model.of.debian.package"
>>> nsPrefix="debian">
>>> <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"
>>> eSuperTypes="#/1/Field"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="PackageName"
>>> eSuperTypes="#/1/Field"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>>> eSuperTypes="#/1/Field"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions"
>>> eSuperTypes="#/1/Field"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions"
>>> eSuperTypes="#/1/Field"/>
>>> <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>
>>
>>
>
>
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Re: [TENEO] Problem of mapping when inheritance hierarchy in a stored metamodel [message #98740 is a reply to message #98662] |
Tue, 09 October 2007 04:25   |
Eclipse User |
|
|
|
Hi Hugo,
I found the issue. Teneo does not identify the eSuperTypes eReference of EClass as a many-to-many
relation (an eclass like Field can be the supertype of more than one subtype, and one type can have
multiple supertypes). The association is not modeled in the db using a join-table but using
foreign-keys. Therefore only one sub-supertype relation is stored (the one from ScriptDescriptions).
An easy workaround is pass this option:
props.put(PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_AS SOCIATIONS, "true");
in this way all one-to-many relations can be used as many-to-many (in the db).
Another option (which is more work but allows you to do specific settings per association):
Create a separate xml file with annotations to tell Teneo that this relation is in fact a
many-to-many. I tested the following xml and it worked fine :
<?xml version="1.0" encoding="utf-8"?>
<persistence-mapping xmlns="http://www.eclipse.org/emft/teneo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<epackage namespace-uri="http://www.eclipse.org/emf/2002/Ecore">
<eclass name="EClass">
<property name="eSuperTypes">
<many-to-many/>
</property>
</eclass>
</epackage>
</persistence-mapping>
You can pass the xml like this to Teneo (set the PersistenceOptions.PERSISTENCE_XML property):
props.setProperty(PersistenceOptions.PERSISTENCE_XML,
"org/eclipse/emf/teneo/hibernate/test/test.persistence.xml");
btw, can you enter a bugzilla for this so that I incorporate this as standard in Teneo (specifically
for the ecore package)?
gr. Martin
Hugo Bruneliere wrote:
> Martin Taal a écrit :
>> Hi Hugo,
>> I tried it and yes the debian.ecore maps correctly. For my
>> understanding what you do is persist the debian.ecore itself also in
>> the db then retrieve it and then use this retrieved debian model to
>> create a hibernate mapping. Am I correct?
>> And this retrieved model does not contain the correct sub-type
>> super-type relations.
>
> Yes that's it. But what is strange is that when I serialize the debian
> model I retrieved, I obtain the same debian.ecore file as the original
> one. I can deduce that the debian.ecore model is well-stored and
> well-retrieved (with the right inheritance tree).
>
> After that I create a new hibernate data store in which I set the
> retrieved Debian EPackage in order to be able to create Debian models.
> But why does the mapping differ this time?
>
> Hugo
>
>>
>> gr. Martin
>>
>> Hugo Bruneliere wrote:
>>> Hugo Bruneliere a écrit :
>>>> Hi Martin,
>>>>
>>>> Martin Taal a écrit :
>>>>> Hi Hugo,
>>>>> This can occur if there are nameclashes.
>>>>>
>>>>> For example assume a small hierarchy: type A inherits from B, and
>>>>> there are two other types C and D, both have a list efeature called
>>>>> myRef, C refers to A and D refers to B. Assume that single-class
>>>>> inheritance mapping is used (so inheritance structure is stored in
>>>>> one table) then A and B are both stored in one table. Then when I
>>>>> create a C (with id=1) with myRef references to A then these
>>>>> references are stored as values in the myRef column in the AB
>>>>> table. Then when I retrieve a D (by accident also with id=1) from
>>>>> the database it will also look in the AB table to see if any
>>>>> references should be loaded. If finds the previously stored A as
>>>>> this record has a column myRef with value 1. It loads this A but
>>>>> fails because it expects B.
>>>>>
>>>>> The above example could also occur here because it fails when
>>>>> loading a collection. You should set a breakpoint in hibernate to
>>>>> check which exact instance is involved here and see which table
>>>>> fields play a role. Based on that you (or I can help) can check
>>>>> which part of the model is the cause and see if by adding
>>>>> annotations this can be solved.
>>>>>
>>>>
>>>> The problem seems to come from the mapping for the Debian metamodel
>>>> (i.e. epackage) which is not correctly generated by Teneo: only the
>>>> "ScriptDescriptions" class is well declared as a subclass of the
>>>> "Field" one, whereas in the metamodel the
>>>> "PackageDescriptions","Dependancy","PackageName" and "Version"
>>>> classes are also subclasses of this one.
>>>>
>>>> This explains why it fails when trying to get from the database an
>>>> instance of "PackageDescriptions","Dependancy","PackageName" or
>>>> "Version" classes.
>>>>
>>>> I attached the Debian metamodel and the mapping file.
>>>>
>>>> Do you see why in this case the mapping is incomplete?
>>>
>>> What is strange is that the mapping generated by the first execution
>>> of the test program (i.e. when adding the "debian_res_thunderbird"
>>> model to the database) is good.
>>>
>>> But during the second execution of it (i.e. when trying to retrieve
>>> the "debian_res_thunderbird" model from the database), the mapping
>>> contains the previously described errors. However, when I try to
>>> retrieve the "Debian" metamodel (i.e. the "Debian" epackage) and to
>>> serialize it, it works well (the Ecore file describes the right
>>> inheritance tree) ?!?
>>>
>>>>
>>>> Best regards,
>>>>
>>>> Hugo
>>>>
>>>>> gr. Martin
>>>>>
>>>>> Hugo Bruneliere wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm having problems with models which conforms to metamodels
>>>>>> containing inheritance hierarchy.
>>>>>>
>>>>>> The Debian metamodel and two sample models conforming to it are
>>>>>> attached to this post.
>>>>>>
>>>>>> In a first execution, I store the metamodel and the two models
>>>>>> using Teneo.
>>>>>> Then in a second execution, I try to reload these models (still
>>>>>> using Teneo) from the previously built database: I succeed in
>>>>>> getting the Debian metamodel and the "res_firefox" model but I
>>>>>> fail in getting the "res_thunderbird" model. The main difference
>>>>>> between the two models is that the second one uses instances of
>>>>>> classes which inherit attributes from another one. It seems to be
>>>>>> the cause of the problem:
>>>>>>
>>>>>> Exception in thread "main" org.hibernate.WrongClassException:
>>>>>> Object with id: 2 was not of the specified subclass: Field
>>>>>> (Discriminator: Dependancy)
>>>>>> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>>>>> at
>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>>>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>>>>> at
>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>>>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>>>>> at
>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>>>>
>>>>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>>>>> at
>>>>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>>>>
>>>>>>
>>>>>>
>>>>>> I took a look at the ecore_eobject table and the
>>>>>> eclass_esupertypes_e_id field does not seem to be correctly
>>>>>> initiated for the concerned Eclass of my Debian metamodel...
>>>>>>
>>>>>>
>>>>>> How can I configure the mapping (and my datastore) to work properly?
>>>>>>
>>>>>> Thanks in advance,
>>>>>>
>>>>>> Hugo
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------ ------------
>>>>
>>>>
>>>> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
>>>> <hibernate-mapping auto-import="false">
>>>> <class entity-name="debian.Deb" abstract="false" lazy="false"
>>>> discriminator-value="debian.Deb" table="`debian_deb`">
>>>> <meta attribute="eclassName">Deb</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="metadata" entity-name="debian.Databin"
>>>> cascade="all" foreign-key="debian_deb_metadata" lazy="false"
>>>> insert="true" update="true" unique="true"/>
>>>> <one-to-one name="control" entity-name="debian.Archcontrol"
>>>> foreign-key="debian_deb_control" cascade="all" property-ref="debc"
>>>> lazy="false"/>
>>>> <one-to-one name="data" entity-name="debian.Archdata"
>>>> foreign-key="debian_deb_data" cascade="all" property-ref="debd"
>>>> lazy="false"/>
>>>> <property name="name" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`name`"/>
>>>> </property>
>>>> </class>
>>>> <class entity-name="debian.Databin" abstract="false"
>>>> lazy="false" discriminator-value="debian.Databin"
>>>> table="`debian_databin`">
>>>> <meta attribute="eclassName">Databin</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <one-to-one name="debpm" entity-name="debian.Deb"
>>>> foreign-key="debian_databin_debpm"
>>>> cascade="merge,persist,save-update,lock,refresh"
>>>> property-ref="metadata" lazy="false"/>
>>>> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="debian_databin_blocs">
>>>> <column name="`bloc_meta_e_id`" not-null="false"
>>>> unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="debian.Bloc"/>
>>>> </bag>
>>>> </class>
>>>> <class entity-name="debian.Bloc" abstract="false" lazy="false"
>>>> discriminator-value="debian.Bloc" table="`debian_bloc`">
>>>> <meta attribute="eclassName">Bloc</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="meta" entity-name="debian.Databin"
>>>> foreign-key="debian_bloc_meta" lazy="false" insert="false"
>>>> update="false" not-null="false">
>>>> <column not-null="false" unique="false"
>>>> name="`bloc_meta_e_id`"/>
>>>> </many-to-one>
>>>> <bag name="field" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="debian_bloc_field">
>>>> <column name="`field_blocs_e_id`" not-null="false"
>>>> unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="debian.Field"/>
>>>> </bag>
>>>> </class>
>>>> <class entity-name="debian.Field" abstract="true" lazy="false"
>>>> discriminator-value="debian.Field" table="`debian_field`">
>>>> <meta attribute="eclassName">Field</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <property name="val" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`val`"/>
>>>> </property>
>>>> <property name="type" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`type`"/>
>>>> </property>
>>>> <many-to-one name="blocs" entity-name="debian.Bloc"
>>>> foreign-key="debian_field_blocs" lazy="false" insert="false"
>>>> update="false" not-null="false">
>>>> <column not-null="false" unique="false"
>>>> name="`field_blocs_e_id`"/>
>>>> </many-to-one>
>>>> </class>
>>>> <class entity-name="debian.Version" abstract="false"
>>>> lazy="false" discriminator-value="debian.Version"
>>>> table="`debian_version`">
>>>> <meta attribute="eclassName">Version</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <class entity-name="debian.PackageName" abstract="false"
>>>> lazy="false" discriminator-value="debian.PackageName"
>>>> table="`debian_packagename`">
>>>> <meta attribute="eclassName">PackageName</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <class entity-name="debian.Dependancy" abstract="false"
>>>> lazy="false" discriminator-value="debian.Dependancy"
>>>> table="`debian_dependancy`">
>>>> <meta attribute="eclassName">Dependancy</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <class entity-name="debian.PackageDescriptions" abstract="false"
>>>> lazy="false" discriminator-value="debian.PackageDescriptions"
>>>> table="`debian_packagedescriptions`">
>>>> <meta attribute="eclassName">PackageDescriptions</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions"
>>>> abstract="false" lazy="false" extends="debian.Field"
>>>> discriminator-value="debian.ScriptDescriptions">
>>>> <meta attribute="eclassName">ScriptDescriptions</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</meta>
>>>> </subclass>
>>>> <class entity-name="debian.Archcontrol" abstract="false"
>>>> lazy="false" discriminator-value="debian.Archcontrol"
>>>> table="`debian_archcontrol`">
>>>> <meta attribute="eclassName">Archcontrol</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="debc" entity-name="debian.Deb"
>>>> cascade="merge,persist,save-update,lock,refresh"
>>>> foreign-key="debian_archcontrol_debc" lazy="false" insert="true"
>>>> update="true" unique="true"/>
>>>> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true"
>>>> foreign-key="debian_archcontrol_scripts">
>>>> <column name="`script_archscript_e_id`"
>>>> not-null="false" unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="debian.Script"/>
>>>> </bag>
>>>> </class>
>>>> <class entity-name="debian.Script" abstract="false" lazy="false"
>>>> discriminator-value="debian.Script" table="`debian_script`">
>>>> <meta attribute="eclassName">Script</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="archscript"
>>>> entity-name="debian.Archcontrol"
>>>> foreign-key="debian_script_archscript" lazy="false" insert="false"
>>>> update="false" not-null="false">
>>>> <column not-null="false" unique="false"
>>>> name="`script_archscript_e_id`"/>
>>>> </many-to-one>
>>>> <property name="script_name" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false"
>>>> name="`script_name`"/>
>>>> </property>
>>>> <property name="code" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`code`"/>
>>>> </property>
>>>> </class>
>>>> <class entity-name="debian.Archdata" abstract="false"
>>>> lazy="false" discriminator-value="debian.Archdata"
>>>> table="`debian_archdata`">
>>>> <meta attribute="eclassName">Archdata</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="debd" entity-name="debian.Deb"
>>>> cascade="merge,persist,save-update,lock,refresh"
>>>> foreign-key="debian_archdata_debd" lazy="false" insert="true"
>>>> update="true" unique="true"/>
>>>> <bag name="fil" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="debian_archdata_fil">
>>>> <column name="`file_data_e_id`" not-null="false"
>>>> unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="debian.File"/>
>>>> </bag>
>>>> <property name="name" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`name`"/>
>>>> </property>
>>>> </class>
>>>> <class entity-name="debian.File" abstract="false" lazy="false"
>>>> discriminator-value="debian.File" table="`debian_file`">
>>>> <meta attribute="eclassName">File</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="data" entity-name="debian.Archdata"
>>>> foreign-key="debian_file_data" lazy="false" insert="false"
>>>> update="false" not-null="false">
>>>> <column not-null="false" unique="false"
>>>> name="`file_data_e_id`"/>
>>>> </many-to-one>
>>>> <property name="filename" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`filename`"/>
>>>> </property>
>>>> <property name="location" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`location`"/>
>>>> </property>
>>>> </class>
>>>> </hibernate-mapping>
>>>>
>>>>
>>>> ------------------------------------------------------------ ------------
>>>>
>>>>
>>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>> <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="Debian" nsURI="my.model.of.debian.package"
>>>> nsPrefix="debian">
>>>> <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"
>>>> eSuperTypes="#/1/Field"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="PackageName"
>>>> eSuperTypes="#/1/Field"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>>>> eSuperTypes="#/1/Field"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions"
>>>> eSuperTypes="#/1/Field"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions"
>>>> eSuperTypes="#/1/Field"/>
>>>> <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>
>>>
>>>
>>
>>
>
>
--
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] Problem of mapping when inheritance hierarchy in a stored metamodel [message #98757 is a reply to message #98740] |
Tue, 09 October 2007 05:25  |
Eclipse User |
|
|
|
Originally posted by: Hugo.Bruneliere.univ-nantes.fr
Hi Martin,
Martin Taal a écrit :
> Hi Hugo,
> I found the issue. Teneo does not identify the eSuperTypes eReference of
> EClass as a many-to-many relation (an eclass like Field can be the
> supertype of more than one subtype, and one type can have multiple
> supertypes). The association is not modeled in the db using a join-table
> but using foreign-keys. Therefore only one sub-supertype relation is
> stored (the one from ScriptDescriptions).
>
> An easy workaround is pass this option:
> props.put(PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_AS SOCIATIONS,
> "true");
> in this way all one-to-many relations can be used as many-to-many (in
> the db).
>
> Another option (which is more work but allows you to do specific
> settings per association):
> Create a separate xml file with annotations to tell Teneo that this
> relation is in fact a many-to-many. I tested the following xml and it
> worked fine :
> <?xml version="1.0" encoding="utf-8"?>
> <persistence-mapping xmlns="http://www.eclipse.org/emft/teneo"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <epackage namespace-uri="http://www.eclipse.org/emf/2002/Ecore">
> <eclass name="EClass">
> <property name="eSuperTypes">
> <many-to-many/>
> </property>
> </eclass>
> </epackage>
> </persistence-mapping>
>
> You can pass the xml like this to Teneo (set the
> PersistenceOptions.PERSISTENCE_XML property):
> props.setProperty(PersistenceOptions.PERSISTENCE_XML,
> "org/eclipse/emf/teneo/hibernate/test/test.persistence.xml");
>
> btw, can you enter a bugzilla for this so that I incorporate this as
> standard in Teneo (specifically for the ecore package)?
>
Thanks a lot, this solves my problem! In my opinion, integrating this
into the standard Teneo is a good idea as this case may be encountered
very frequently when dealing with elaborated Ecore models.
As you requested, here is the bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205790
Best regards,
Hugo
> gr. Martin
>
> Hugo Bruneliere wrote:
>> Martin Taal a écrit :
>>> Hi Hugo,
>>> I tried it and yes the debian.ecore maps correctly. For my
>>> understanding what you do is persist the debian.ecore itself also in
>>> the db then retrieve it and then use this retrieved debian model to
>>> create a hibernate mapping. Am I correct?
>>> And this retrieved model does not contain the correct sub-type
>>> super-type relations.
>>
>> Yes that's it. But what is strange is that when I serialize the debian
>> model I retrieved, I obtain the same debian.ecore file as the original
>> one. I can deduce that the debian.ecore model is well-stored and
>> well-retrieved (with the right inheritance tree).
>>
>> After that I create a new hibernate data store in which I set the
>> retrieved Debian EPackage in order to be able to create Debian models.
>> But why does the mapping differ this time?
>>
>> Hugo
>>
>>>
>>> gr. Martin
>>>
>>> Hugo Bruneliere wrote:
>>>> Hugo Bruneliere a écrit :
>>>>> Hi Martin,
>>>>>
>>>>> Martin Taal a écrit :
>>>>>> Hi Hugo,
>>>>>> This can occur if there are nameclashes.
>>>>>>
>>>>>> For example assume a small hierarchy: type A inherits from B, and
>>>>>> there are two other types C and D, both have a list efeature
>>>>>> called myRef, C refers to A and D refers to B. Assume that
>>>>>> single-class inheritance mapping is used (so inheritance structure
>>>>>> is stored in one table) then A and B are both stored in one table.
>>>>>> Then when I create a C (with id=1) with myRef references to A then
>>>>>> these references are stored as values in the myRef column in the
>>>>>> AB table. Then when I retrieve a D (by accident also with id=1)
>>>>>> from the database it will also look in the AB table to see if any
>>>>>> references should be loaded. If finds the previously stored A as
>>>>>> this record has a column myRef with value 1. It loads this A but
>>>>>> fails because it expects B.
>>>>>>
>>>>>> The above example could also occur here because it fails when
>>>>>> loading a collection. You should set a breakpoint in hibernate to
>>>>>> check which exact instance is involved here and see which table
>>>>>> fields play a role. Based on that you (or I can help) can check
>>>>>> which part of the model is the cause and see if by adding
>>>>>> annotations this can be solved.
>>>>>>
>>>>>
>>>>> The problem seems to come from the mapping for the Debian metamodel
>>>>> (i.e. epackage) which is not correctly generated by Teneo: only the
>>>>> "ScriptDescriptions" class is well declared as a subclass of the
>>>>> "Field" one, whereas in the metamodel the
>>>>> "PackageDescriptions","Dependancy","PackageName" and "Version"
>>>>> classes are also subclasses of this one.
>>>>>
>>>>> This explains why it fails when trying to get from the database an
>>>>> instance of "PackageDescriptions","Dependancy","PackageName" or
>>>>> "Version" classes.
>>>>>
>>>>> I attached the Debian metamodel and the mapping file.
>>>>>
>>>>> Do you see why in this case the mapping is incomplete?
>>>>
>>>> What is strange is that the mapping generated by the first execution
>>>> of the test program (i.e. when adding the "debian_res_thunderbird"
>>>> model to the database) is good.
>>>>
>>>> But during the second execution of it (i.e. when trying to retrieve
>>>> the "debian_res_thunderbird" model from the database), the mapping
>>>> contains the previously described errors. However, when I try to
>>>> retrieve the "Debian" metamodel (i.e. the "Debian" epackage) and to
>>>> serialize it, it works well (the Ecore file describes the right
>>>> inheritance tree) ?!?
>>>>
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Hugo
>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Hugo Bruneliere wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm having problems with models which conforms to metamodels
>>>>>>> containing inheritance hierarchy.
>>>>>>>
>>>>>>> The Debian metamodel and two sample models conforming to it are
>>>>>>> attached to this post.
>>>>>>>
>>>>>>> In a first execution, I store the metamodel and the two models
>>>>>>> using Teneo.
>>>>>>> Then in a second execution, I try to reload these models (still
>>>>>>> using Teneo) from the previously built database: I succeed in
>>>>>>> getting the Debian metamodel and the "res_firefox" model but I
>>>>>>> fail in getting the "res_thunderbird" model. The main difference
>>>>>>> between the two models is that the second one uses instances of
>>>>>>> classes which inherit attributes from another one. It seems to be
>>>>>>> the cause of the problem:
>>>>>>>
>>>>>>> Exception in thread "main" org.hibernate.WrongClassException:
>>>>>>> Object with id: 2 was not of the specified subclass: Field
>>>>>>> (Discriminator: Dependancy)
>>>>>>> at
>>>>>>> org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>>>>>> at
>>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>>>>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>>>>>> at
>>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>>>>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>>>>>> at
>>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>>>>>
>>>>>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>>>>>> at
>>>>>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I took a look at the ecore_eobject table and the
>>>>>>> eclass_esupertypes_e_id field does not seem to be correctly
>>>>>>> initiated for the concerned Eclass of my Debian metamodel...
>>>>>>>
>>>>>>>
>>>>>>> How can I configure the mapping (and my datastore) to work properly?
>>>>>>>
>>>>>>> Thanks in advance,
>>>>>>>
>>>>>>> Hugo
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------ ------------
>>>>>
>>>>>
>>>>> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
>>>>> <hibernate-mapping auto-import="false">
>>>>> <class entity-name="debian.Deb" abstract="false" lazy="false"
>>>>> discriminator-value="debian.Deb" table="`debian_deb`">
>>>>> <meta attribute="eclassName">Deb</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="metadata" entity-name="debian.Databin"
>>>>> cascade="all" foreign-key="debian_deb_metadata" lazy="false"
>>>>> insert="true" update="true" unique="true"/>
>>>>> <one-to-one name="control" entity-name="debian.Archcontrol"
>>>>> foreign-key="debian_deb_control" cascade="all" property-ref="debc"
>>>>> lazy="false"/>
>>>>> <one-to-one name="data" entity-name="debian.Archdata"
>>>>> foreign-key="debian_deb_data" cascade="all" property-ref="debd"
>>>>> lazy="false"/>
>>>>> <property name="name" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`name`"/>
>>>>> </property>
>>>>> </class>
>>>>> <class entity-name="debian.Databin" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Databin"
>>>>> table="`debian_databin`">
>>>>> <meta attribute="eclassName">Databin</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <one-to-one name="debpm" entity-name="debian.Deb"
>>>>> foreign-key="debian_databin_debpm"
>>>>> cascade="merge,persist,save-update,lock,refresh"
>>>>> property-ref="metadata" lazy="false"/>
>>>>> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true" foreign-key="debian_databin_blocs">
>>>>> <column name="`bloc_meta_e_id`" not-null="false"
>>>>> unique="false"/>
>>>>> </key>
>>>>> <one-to-many entity-name="debian.Bloc"/>
>>>>> </bag>
>>>>> </class>
>>>>> <class entity-name="debian.Bloc" abstract="false" lazy="false"
>>>>> discriminator-value="debian.Bloc" table="`debian_bloc`">
>>>>> <meta attribute="eclassName">Bloc</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="meta" entity-name="debian.Databin"
>>>>> foreign-key="debian_bloc_meta" lazy="false" insert="false"
>>>>> update="false" not-null="false">
>>>>> <column not-null="false" unique="false"
>>>>> name="`bloc_meta_e_id`"/>
>>>>> </many-to-one>
>>>>> <bag name="field" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true" foreign-key="debian_bloc_field">
>>>>> <column name="`field_blocs_e_id`" not-null="false"
>>>>> unique="false"/>
>>>>> </key>
>>>>> <one-to-many entity-name="debian.Field"/>
>>>>> </bag>
>>>>> </class>
>>>>> <class entity-name="debian.Field" abstract="true" lazy="false"
>>>>> discriminator-value="debian.Field" table="`debian_field`">
>>>>> <meta attribute="eclassName">Field</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <property name="val" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`val`"/>
>>>>> </property>
>>>>> <property name="type" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`type`"/>
>>>>> </property>
>>>>> <many-to-one name="blocs" entity-name="debian.Bloc"
>>>>> foreign-key="debian_field_blocs" lazy="false" insert="false"
>>>>> update="false" not-null="false">
>>>>> <column not-null="false" unique="false"
>>>>> name="`field_blocs_e_id`"/>
>>>>> </many-to-one>
>>>>> </class>
>>>>> <class entity-name="debian.Version" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Version"
>>>>> table="`debian_version`">
>>>>> <meta attribute="eclassName">Version</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <class entity-name="debian.PackageName" abstract="false"
>>>>> lazy="false" discriminator-value="debian.PackageName"
>>>>> table="`debian_packagename`">
>>>>> <meta attribute="eclassName">PackageName</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <class entity-name="debian.Dependancy" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Dependancy"
>>>>> table="`debian_dependancy`">
>>>>> <meta attribute="eclassName">Dependancy</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <class entity-name="debian.PackageDescriptions"
>>>>> abstract="false" lazy="false"
>>>>> discriminator-value="debian.PackageDescriptions"
>>>>> table="`debian_packagedescriptions`">
>>>>> <meta attribute="eclassName">PackageDescriptions</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions"
>>>>> abstract="false" lazy="false" extends="debian.Field"
>>>>> discriminator-value="debian.ScriptDescriptions">
>>>>> <meta attribute="eclassName">ScriptDescriptions</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</meta>
>>>>> </subclass>
>>>>> <class entity-name="debian.Archcontrol" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Archcontrol"
>>>>> table="`debian_archcontrol`">
>>>>> <meta attribute="eclassName">Archcontrol</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="debc" entity-name="debian.Deb"
>>>>> cascade="merge,persist,save-update,lock,refresh"
>>>>> foreign-key="debian_archcontrol_debc" lazy="false" insert="true"
>>>>> update="true" unique="true"/>
>>>>> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true"
>>>>> foreign-key="debian_archcontrol_scripts">
>>>>> <column name="`script_archscript_e_id`"
>>>>> not-null="false" unique="false"/>
>>>>> </key>
>>>>> <one-to-many entity-name="debian.Script"/>
>>>>> </bag>
>>>>> </class>
>>>>> <class entity-name="debian.Script" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Script"
>>>>> table="`debian_script`">
>>>>> <meta attribute="eclassName">Script</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="archscript"
>>>>> entity-name="debian.Archcontrol"
>>>>> foreign-key="debian_script_archscript" lazy="false" insert="false"
>>>>> update="false" not-null="false">
>>>>> <column not-null="false" unique="false"
>>>>> name="`script_archscript_e_id`"/>
>>>>> </many-to-one>
>>>>> <property name="script_name" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false"
>>>>> name="`script_name`"/>
>>>>> </property>
>>>>> <property name="code" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`code`"/>
>>>>> </property>
>>>>> </class>
>>>>> <class entity-name="debian.Archdata" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Archdata"
>>>>> table="`debian_archdata`">
>>>>> <meta attribute="eclassName">Archdata</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="debd" entity-name="debian.Deb"
>>>>> cascade="merge,persist,save-update,lock,refresh"
>>>>> foreign-key="debian_archdata_debd" lazy="false" insert="true"
>>>>> update="true" unique="true"/>
>>>>> <bag name="fil" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true" foreign-key="debian_archdata_fil">
>>>>> <column name="`file_data_e_id`" not-null="false"
>>>>> unique="false"/>
>>>>> </key>
>>>>> <one-to-many entity-name="debian.File"/>
>>>>> </bag>
>>>>> <property name="name" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`name`"/>
>>>>> </property>
>>>>> </class>
>>>>> <class entity-name="debian.File" abstract="false" lazy="false"
>>>>> discriminator-value="debian.File" table="`debian_file`">
>>>>> <meta attribute="eclassName">File</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="data" entity-name="debian.Archdata"
>>>>> foreign-key="debian_file_data" lazy="false" insert="false"
>>>>> update="false" not-null="false">
>>>>> <column not-null="false" unique="false"
>>>>> name="`file_data_e_id`"/>
>>>>> </many-to-one>
>>>>> <property name="filename" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`filename`"/>
>>>>> </property>
>>>>> <property name="location" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`location`"/>
>>>>> </property>
>>>>> </class>
>>>>> </hibernate-mapping>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------ ------------
>>>>>
>>>>>
>>>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>>> <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="Debian" nsURI="my.model.of.debian.package"
>>>>> nsPrefix="debian">
>>>>> <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"
>>>>> eSuperTypes="#/1/Field"/>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="PackageName"
>>>>> eSuperTypes="#/1/Field"/>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>>>>> eSuperTypes="#/1/Field"/>
>>>>> <eClassifiers xsi:type="ecore:EClass"
>>>>> name="PackageDescriptions" eSuperTypes="#/1/Field"/>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions"
>>>>> eSuperTypes="#/1/Field"/>
>>>>> <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>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Re: [TENEO] Problem of mapping when inheritance hierarchy in a stored metamodel [message #609875 is a reply to message #98343] |
Wed, 03 October 2007 14:24  |
Eclipse User |
|
|
|
Hi Hugo,
This can occur if there are nameclashes.
For example assume a small hierarchy: type A inherits from B, and there are two other types C and D,
both have a list efeature called myRef, C refers to A and D refers to B. Assume that single-class
inheritance mapping is used (so inheritance structure is stored in one table) then A and B are both
stored in one table. Then when I create a C (with id=1) with myRef references to A then these
references are stored as values in the myRef column in the AB table. Then when I retrieve a D (by
accident also with id=1) from the database it will also look in the AB table to see if any
references should be loaded. If finds the previously stored A as this record has a column myRef with
value 1. It loads this A but fails because it expects B.
The above example could also occur here because it fails when loading a collection. You should set a
breakpoint in hibernate to check which exact instance is involved here and see which table fields
play a role. Based on that you (or I can help) can check which part of the model is the cause and
see if by adding annotations this can be solved.
gr. Martin
Hugo Bruneliere wrote:
> Hi,
>
> I'm having problems with models which conforms to metamodels containing
> inheritance hierarchy.
>
> The Debian metamodel and two sample models conforming to it are attached
> to this post.
>
> In a first execution, I store the metamodel and the two models using Teneo.
> Then in a second execution, I try to reload these models (still using
> Teneo) from the previously built database: I succeed in getting the
> Debian metamodel and the "res_firefox" model but I fail in getting the
> "res_thunderbird" model. The main difference between the two models is
> that the second one uses instances of classes which inherit attributes
> from another one. It seems to be the cause of the problem:
>
> Exception in thread "main" org.hibernate.WrongClassException: Object
> with id: 2 was not of the specified subclass: Field (Discriminator:
> Dependancy)
> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
> at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
> at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>
> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
> at
> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>
> at
> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>
> at
> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>
> at
> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>
> at
> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
> at
> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>
> at
> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>
> at
> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
> at
> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>
> at
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>
> at
> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>
>
>
> I took a look at the ecore_eobject table and the eclass_esupertypes_e_id
> field does not seem to be correctly initiated for the concerned Eclass
> of my Debian metamodel...
>
>
> How can I configure the mapping (and my datastore) to work properly?
>
> Thanks in advance,
>
> Hugo
>
--
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] Problem of mapping when inheritance hierarchy in a stored metamodel [message #609913 is a reply to message #98564] |
Mon, 08 October 2007 09:39  |
Eclipse User |
|
|
|
Hugo Bruneliere a écrit :
> Hi Martin,
>
> Martin Taal a écrit :
>> Hi Hugo,
>> This can occur if there are nameclashes.
>>
>> For example assume a small hierarchy: type A inherits from B, and
>> there are two other types C and D, both have a list efeature called
>> myRef, C refers to A and D refers to B. Assume that single-class
>> inheritance mapping is used (so inheritance structure is stored in one
>> table) then A and B are both stored in one table. Then when I create a
>> C (with id=1) with myRef references to A then these references are
>> stored as values in the myRef column in the AB table. Then when I
>> retrieve a D (by accident also with id=1) from the database it will
>> also look in the AB table to see if any references should be loaded.
>> If finds the previously stored A as this record has a column myRef
>> with value 1. It loads this A but fails because it expects B.
>>
>> The above example could also occur here because it fails when loading
>> a collection. You should set a breakpoint in hibernate to check which
>> exact instance is involved here and see which table fields play a
>> role. Based on that you (or I can help) can check which part of the
>> model is the cause and see if by adding annotations this can be solved.
>>
>
> The problem seems to come from the mapping for the Debian metamodel
> (i.e. epackage) which is not correctly generated by Teneo: only the
> "ScriptDescriptions" class is well declared as a subclass of the "Field"
> one, whereas in the metamodel the
> "PackageDescriptions","Dependancy","PackageName" and "Version" classes
> are also subclasses of this one.
>
> This explains why it fails when trying to get from the database an
> instance of "PackageDescriptions","Dependancy","PackageName" or
> "Version" classes.
>
> I attached the Debian metamodel and the mapping file.
>
> Do you see why in this case the mapping is incomplete?
What is strange is that the mapping generated by the first execution of
the test program (i.e. when adding the "debian_res_thunderbird" model to
the database) is good.
But during the second execution of it (i.e. when trying to retrieve the
"debian_res_thunderbird" model from the database), the mapping contains
the previously described errors. However, when I try to retrieve the
"Debian" metamodel (i.e. the "Debian" epackage) and to serialize it, it
works well (the Ecore file describes the right inheritance tree) ?!?
>
> Best regards,
>
> Hugo
>
>> gr. Martin
>>
>> Hugo Bruneliere wrote:
>>> Hi,
>>>
>>> I'm having problems with models which conforms to metamodels
>>> containing inheritance hierarchy.
>>>
>>> The Debian metamodel and two sample models conforming to it are
>>> attached to this post.
>>>
>>> In a first execution, I store the metamodel and the two models using
>>> Teneo.
>>> Then in a second execution, I try to reload these models (still using
>>> Teneo) from the previously built database: I succeed in getting the
>>> Debian metamodel and the "res_firefox" model but I fail in getting
>>> the "res_thunderbird" model. The main difference between the two
>>> models is that the second one uses instances of classes which inherit
>>> attributes from another one. It seems to be the cause of the problem:
>>>
>>> Exception in thread "main" org.hibernate.WrongClassException: Object
>>> with id: 2 was not of the specified subclass: Field (Discriminator:
>>> Dependancy)
>>> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>> at
>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>> at
>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>
>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>> at
>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>
>>> at
>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>
>>> at
>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>
>>> at
>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>
>>> at
>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>> at
>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>
>>> at
>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>
>>> at
>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>
>>> at
>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>
>>> at
>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>
>>> at
>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>
>>> at
>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>
>>> at
>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>
>>>
>>>
>>> I took a look at the ecore_eobject table and the
>>> eclass_esupertypes_e_id field does not seem to be correctly initiated
>>> for the concerned Eclass of my Debian metamodel...
>>>
>>>
>>> How can I configure the mapping (and my datastore) to work properly?
>>>
>>> Thanks in advance,
>>>
>>> Hugo
>>>
>>
>>
>
>
>
> ------------------------------------------------------------ ------------
>
> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
> <hibernate-mapping auto-import="false">
> <class entity-name="debian.Deb" abstract="false" lazy="false" discriminator-value="debian.Deb" table="`debian_deb`">
> <meta attribute="eclassName">Deb</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="metadata" entity-name="debian.Databin" cascade="all" foreign-key="debian_deb_metadata" lazy="false" insert="true" update="true" unique="true"/>
> <one-to-one name="control" entity-name="debian.Archcontrol" foreign-key="debian_deb_control" cascade="all" property-ref="debc" lazy="false"/>
> <one-to-one name="data" entity-name="debian.Archdata" foreign-key="debian_deb_data" cascade="all" property-ref="debd" lazy="false"/>
> <property name="name" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`name`"/>
> </property>
> </class>
> <class entity-name="debian.Databin" abstract="false" lazy="false" discriminator-value="debian.Databin" table="`debian_databin`">
> <meta attribute="eclassName">Databin</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <one-to-one name="debpm" entity-name="debian.Deb" foreign-key="debian_databin_debpm" cascade="merge,persist,save-update,lock,refresh" property-ref="metadata" lazy="false"/>
> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="debian_databin_blocs">
> <column name="`bloc_meta_e_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="debian.Bloc"/>
> </bag>
> </class>
> <class entity-name="debian.Bloc" abstract="false" lazy="false" discriminator-value="debian.Bloc" table="`debian_bloc`">
> <meta attribute="eclassName">Bloc</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="meta" entity-name="debian.Databin" foreign-key="debian_bloc_meta" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`bloc_meta_e_id`"/>
> </many-to-one>
> <bag name="field" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="debian_bloc_field">
> <column name="`field_blocs_e_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="debian.Field"/>
> </bag>
> </class>
> <class entity-name="debian.Field" abstract="true" lazy="false" discriminator-value="debian.Field" table="`debian_field`">
> <meta attribute="eclassName">Field</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <property name="val" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`val`"/>
> </property>
> <property name="type" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`type`"/>
> </property>
> <many-to-one name="blocs" entity-name="debian.Bloc" foreign-key="debian_field_blocs" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`field_blocs_e_id`"/>
> </many-to-one>
> </class>
> <class entity-name="debian.Version" abstract="false" lazy="false" discriminator-value="debian.Version" table="`debian_version`">
> <meta attribute="eclassName">Version</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <class entity-name="debian.PackageName" abstract="false" lazy="false" discriminator-value="debian.PackageName" table="`debian_packagename`">
> <meta attribute="eclassName">PackageName</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <class entity-name="debian.Dependancy" abstract="false" lazy="false" discriminator-value="debian.Dependancy" table="`debian_dependancy`">
> <meta attribute="eclassName">Dependancy</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <class entity-name="debian.PackageDescriptions" abstract="false" lazy="false" discriminator-value="debian.PackageDescriptions" table="`debian_packagedescriptions`">
> <meta attribute="eclassName">PackageDescriptions</meta>
> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions" abstract="false" lazy="false" extends="debian.Field" discriminator-value="debian.ScriptDescriptions">
> <meta attribute="eclassName">ScriptDescriptions</meta>
> <meta attribute="epackage">my.model.of.debian.package</meta>
> </subclass>
> <class entity-name="debian.Archcontrol" abstract="false" lazy="false" discriminator-value="debian.Archcontrol" table="`debian_archcontrol`">
> <meta attribute="eclassName">Archcontrol</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="debc" entity-name="debian.Deb" cascade="merge,persist,save-update,lock,refresh" foreign-key="debian_archcontrol_debc" lazy="false" insert="true" update="true" unique="true"/>
> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="debian_archcontrol_scripts">
> <column name="`script_archscript_e_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="debian.Script"/>
> </bag>
> </class>
> <class entity-name="debian.Script" abstract="false" lazy="false" discriminator-value="debian.Script" table="`debian_script`">
> <meta attribute="eclassName">Script</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="archscript" entity-name="debian.Archcontrol" foreign-key="debian_script_archscript" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`script_archscript_e_id`"/>
> </many-to-one>
> <property name="script_name" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`script_name`"/>
> </property>
> <property name="code" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`code`"/>
> </property>
> </class>
> <class entity-name="debian.Archdata" abstract="false" lazy="false" discriminator-value="debian.Archdata" table="`debian_archdata`">
> <meta attribute="eclassName">Archdata</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="debd" entity-name="debian.Deb" cascade="merge,persist,save-update,lock,refresh" foreign-key="debian_archdata_debd" lazy="false" insert="true" update="true" unique="true"/>
> <bag name="fil" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="debian_archdata_fil">
> <column name="`file_data_e_id`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="debian.File"/>
> </bag>
> <property name="name" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`name`"/>
> </property>
> </class>
> <class entity-name="debian.File" abstract="false" lazy="false" discriminator-value="debian.File" table="`debian_file`">
> <meta attribute="eclassName">File</meta>
> <meta attribute="epackage">my.model.of.debian.package</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>
> <many-to-one name="data" entity-name="debian.Archdata" foreign-key="debian_file_data" lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false" name="`file_data_e_id`"/>
> </many-to-one>
> <property name="filename" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`filename`"/>
> </property>
> <property name="location" lazy="false" insert="true" update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false" name="`location`"/>
> </property>
> </class>
> </hibernate-mapping>
>
>
> ------------------------------------------------------------ ------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <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="Debian" nsURI="my.model.of.debian.package" nsPrefix="debian">
> <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" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="PackageName" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="Dependancy" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions" eSuperTypes="#/1/Field"/>
> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions" eSuperTypes="#/1/Field"/>
> <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>
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Re: [TENEO] Problem of mapping when inheritance hierarchy in a stored metamodel [message #609925 is a reply to message #98583] |
Mon, 08 October 2007 11:02  |
Eclipse User |
|
|
|
Hi Hugo,
I tried it and yes the debian.ecore maps correctly. For my understanding what you do is persist the
debian.ecore itself also in the db then retrieve it and then use this retrieved debian model to
create a hibernate mapping. Am I correct?
And this retrieved model does not contain the correct sub-type super-type relations.
gr. Martin
Hugo Bruneliere wrote:
> Hugo Bruneliere a écrit :
>> Hi Martin,
>>
>> Martin Taal a écrit :
>>> Hi Hugo,
>>> This can occur if there are nameclashes.
>>>
>>> For example assume a small hierarchy: type A inherits from B, and
>>> there are two other types C and D, both have a list efeature called
>>> myRef, C refers to A and D refers to B. Assume that single-class
>>> inheritance mapping is used (so inheritance structure is stored in
>>> one table) then A and B are both stored in one table. Then when I
>>> create a C (with id=1) with myRef references to A then these
>>> references are stored as values in the myRef column in the AB table.
>>> Then when I retrieve a D (by accident also with id=1) from the
>>> database it will also look in the AB table to see if any references
>>> should be loaded. If finds the previously stored A as this record has
>>> a column myRef with value 1. It loads this A but fails because it
>>> expects B.
>>>
>>> The above example could also occur here because it fails when loading
>>> a collection. You should set a breakpoint in hibernate to check which
>>> exact instance is involved here and see which table fields play a
>>> role. Based on that you (or I can help) can check which part of the
>>> model is the cause and see if by adding annotations this can be solved.
>>>
>>
>> The problem seems to come from the mapping for the Debian metamodel
>> (i.e. epackage) which is not correctly generated by Teneo: only the
>> "ScriptDescriptions" class is well declared as a subclass of the
>> "Field" one, whereas in the metamodel the
>> "PackageDescriptions","Dependancy","PackageName" and "Version" classes
>> are also subclasses of this one.
>>
>> This explains why it fails when trying to get from the database an
>> instance of "PackageDescriptions","Dependancy","PackageName" or
>> "Version" classes.
>>
>> I attached the Debian metamodel and the mapping file.
>>
>> Do you see why in this case the mapping is incomplete?
>
> What is strange is that the mapping generated by the first execution of
> the test program (i.e. when adding the "debian_res_thunderbird" model to
> the database) is good.
>
> But during the second execution of it (i.e. when trying to retrieve the
> "debian_res_thunderbird" model from the database), the mapping contains
> the previously described errors. However, when I try to retrieve the
> "Debian" metamodel (i.e. the "Debian" epackage) and to serialize it, it
> works well (the Ecore file describes the right inheritance tree) ?!?
>
>>
>> Best regards,
>>
>> Hugo
>>
>>> gr. Martin
>>>
>>> Hugo Bruneliere wrote:
>>>> Hi,
>>>>
>>>> I'm having problems with models which conforms to metamodels
>>>> containing inheritance hierarchy.
>>>>
>>>> The Debian metamodel and two sample models conforming to it are
>>>> attached to this post.
>>>>
>>>> In a first execution, I store the metamodel and the two models using
>>>> Teneo.
>>>> Then in a second execution, I try to reload these models (still
>>>> using Teneo) from the previously built database: I succeed in
>>>> getting the Debian metamodel and the "res_firefox" model but I fail
>>>> in getting the "res_thunderbird" model. The main difference between
>>>> the two models is that the second one uses instances of classes
>>>> which inherit attributes from another one. It seems to be the cause
>>>> of the problem:
>>>>
>>>> Exception in thread "main" org.hibernate.WrongClassException: Object
>>>> with id: 2 was not of the specified subclass: Field (Discriminator:
>>>> Dependancy)
>>>> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>>> at
>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>>> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>>> at
>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>>
>>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>>> at
>>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>>
>>>> at
>>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>>
>>>> at
>>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>>
>>>> at
>>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>>
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>>
>>>> at
>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>
>>>> at
>>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>>
>>>> at
>>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>
>>>> at
>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>>
>>>>
>>>>
>>>> I took a look at the ecore_eobject table and the
>>>> eclass_esupertypes_e_id field does not seem to be correctly
>>>> initiated for the concerned Eclass of my Debian metamodel...
>>>>
>>>>
>>>> How can I configure the mapping (and my datastore) to work properly?
>>>>
>>>> Thanks in advance,
>>>>
>>>> Hugo
>>>>
>>>
>>>
>>
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
>> <hibernate-mapping auto-import="false">
>> <class entity-name="debian.Deb" abstract="false" lazy="false"
>> discriminator-value="debian.Deb" table="`debian_deb`">
>> <meta attribute="eclassName">Deb</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="metadata" entity-name="debian.Databin"
>> cascade="all" foreign-key="debian_deb_metadata" lazy="false"
>> insert="true" update="true" unique="true"/>
>> <one-to-one name="control" entity-name="debian.Archcontrol"
>> foreign-key="debian_deb_control" cascade="all" property-ref="debc"
>> lazy="false"/>
>> <one-to-one name="data" entity-name="debian.Archdata"
>> foreign-key="debian_deb_data" cascade="all" property-ref="debd"
>> lazy="false"/>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`name`"/>
>> </property>
>> </class>
>> <class entity-name="debian.Databin" abstract="false" lazy="false"
>> discriminator-value="debian.Databin" table="`debian_databin`">
>> <meta attribute="eclassName">Databin</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <one-to-one name="debpm" entity-name="debian.Deb"
>> foreign-key="debian_databin_debpm"
>> cascade="merge,persist,save-update,lock,refresh"
>> property-ref="metadata" lazy="false"/>
>> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="debian_databin_blocs">
>> <column name="`bloc_meta_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <one-to-many entity-name="debian.Bloc"/>
>> </bag>
>> </class>
>> <class entity-name="debian.Bloc" abstract="false" lazy="false"
>> discriminator-value="debian.Bloc" table="`debian_bloc`">
>> <meta attribute="eclassName">Bloc</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="meta" entity-name="debian.Databin"
>> foreign-key="debian_bloc_meta" lazy="false" insert="false"
>> update="false" not-null="false">
>> <column not-null="false" unique="false"
>> name="`bloc_meta_e_id`"/>
>> </many-to-one>
>> <bag name="field" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="debian_bloc_field">
>> <column name="`field_blocs_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <one-to-many entity-name="debian.Field"/>
>> </bag>
>> </class>
>> <class entity-name="debian.Field" abstract="true" lazy="false"
>> discriminator-value="debian.Field" table="`debian_field`">
>> <meta attribute="eclassName">Field</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <property name="val" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`val`"/>
>> </property>
>> <property name="type" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`type`"/>
>> </property>
>> <many-to-one name="blocs" entity-name="debian.Bloc"
>> foreign-key="debian_field_blocs" lazy="false" insert="false"
>> update="false" not-null="false">
>> <column not-null="false" unique="false"
>> name="`field_blocs_e_id`"/>
>> </many-to-one>
>> </class>
>> <class entity-name="debian.Version" abstract="false" lazy="false"
>> discriminator-value="debian.Version" table="`debian_version`">
>> <meta attribute="eclassName">Version</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <class entity-name="debian.PackageName" abstract="false"
>> lazy="false" discriminator-value="debian.PackageName"
>> table="`debian_packagename`">
>> <meta attribute="eclassName">PackageName</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <class entity-name="debian.Dependancy" abstract="false"
>> lazy="false" discriminator-value="debian.Dependancy"
>> table="`debian_dependancy`">
>> <meta attribute="eclassName">Dependancy</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <class entity-name="debian.PackageDescriptions" abstract="false"
>> lazy="false" discriminator-value="debian.PackageDescriptions"
>> table="`debian_packagedescriptions`">
>> <meta attribute="eclassName">PackageDescriptions</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions" abstract="false"
>> lazy="false" extends="debian.Field"
>> discriminator-value="debian.ScriptDescriptions">
>> <meta attribute="eclassName">ScriptDescriptions</meta>
>> <meta attribute="epackage">my.model.of.debian.package</meta>
>> </subclass>
>> <class entity-name="debian.Archcontrol" abstract="false"
>> lazy="false" discriminator-value="debian.Archcontrol"
>> table="`debian_archcontrol`">
>> <meta attribute="eclassName">Archcontrol</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="debc" entity-name="debian.Deb"
>> cascade="merge,persist,save-update,lock,refresh"
>> foreign-key="debian_archcontrol_debc" lazy="false" insert="true"
>> update="true" unique="true"/>
>> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="debian_archcontrol_scripts">
>> <column name="`script_archscript_e_id`"
>> not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="debian.Script"/>
>> </bag>
>> </class>
>> <class entity-name="debian.Script" abstract="false" lazy="false"
>> discriminator-value="debian.Script" table="`debian_script`">
>> <meta attribute="eclassName">Script</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="archscript"
>> entity-name="debian.Archcontrol"
>> foreign-key="debian_script_archscript" lazy="false" insert="false"
>> update="false" not-null="false">
>> <column not-null="false" unique="false"
>> name="`script_archscript_e_id`"/>
>> </many-to-one>
>> <property name="script_name" lazy="false" insert="true"
>> update="true" not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`script_name`"/>
>> </property>
>> <property name="code" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`code`"/>
>> </property>
>> </class>
>> <class entity-name="debian.Archdata" abstract="false" lazy="false"
>> discriminator-value="debian.Archdata" table="`debian_archdata`">
>> <meta attribute="eclassName">Archdata</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="debd" entity-name="debian.Deb"
>> cascade="merge,persist,save-update,lock,refresh"
>> foreign-key="debian_archdata_debd" lazy="false" insert="true"
>> update="true" unique="true"/>
>> <bag name="fil" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="debian_archdata_fil">
>> <column name="`file_data_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <one-to-many entity-name="debian.File"/>
>> </bag>
>> <property name="name" lazy="false" insert="true" update="true"
>> not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`name`"/>
>> </property>
>> </class>
>> <class entity-name="debian.File" abstract="false" lazy="false"
>> discriminator-value="debian.File" table="`debian_file`">
>> <meta attribute="eclassName">File</meta>
>> <meta attribute="epackage">my.model.of.debian.package</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>
>> <many-to-one name="data" entity-name="debian.Archdata"
>> foreign-key="debian_file_data" lazy="false" insert="false"
>> update="false" not-null="false">
>> <column not-null="false" unique="false"
>> name="`file_data_e_id`"/>
>> </many-to-one>
>> <property name="filename" lazy="false" insert="true"
>> update="true" not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`filename`"/>
>> </property>
>> <property name="location" lazy="false" insert="true"
>> update="true" not-null="true" unique="false" type="java.lang.String">
>> <column not-null="true" unique="false" name="`location`"/>
>> </property>
>> </class>
>> </hibernate-mapping>
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <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="Debian" nsURI="my.model.of.debian.package"
>> nsPrefix="debian">
>> <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"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="PackageName"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions"
>> eSuperTypes="#/1/Field"/>
>> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions"
>> eSuperTypes="#/1/Field"/>
>> <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>
>
>
--
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] Problem of mapping when inheritance hierarchy in a stored metamodel [message #609931 is a reply to message #98627] |
Mon, 08 October 2007 12:09  |
Eclipse User |
|
|
|
Martin Taal a écrit :
> Hi Hugo,
> I tried it and yes the debian.ecore maps correctly. For my understanding
> what you do is persist the debian.ecore itself also in the db then
> retrieve it and then use this retrieved debian model to create a
> hibernate mapping. Am I correct?
> And this retrieved model does not contain the correct sub-type
> super-type relations.
Yes that's it. But what is strange is that when I serialize the debian
model I retrieved, I obtain the same debian.ecore file as the original
one. I can deduce that the debian.ecore model is well-stored and
well-retrieved (with the right inheritance tree).
After that I create a new hibernate data store in which I set the
retrieved Debian EPackage in order to be able to create Debian models.
But why does the mapping differ this time?
Hugo
>
> gr. Martin
>
> Hugo Bruneliere wrote:
>> Hugo Bruneliere a écrit :
>>> Hi Martin,
>>>
>>> Martin Taal a écrit :
>>>> Hi Hugo,
>>>> This can occur if there are nameclashes.
>>>>
>>>> For example assume a small hierarchy: type A inherits from B, and
>>>> there are two other types C and D, both have a list efeature called
>>>> myRef, C refers to A and D refers to B. Assume that single-class
>>>> inheritance mapping is used (so inheritance structure is stored in
>>>> one table) then A and B are both stored in one table. Then when I
>>>> create a C (with id=1) with myRef references to A then these
>>>> references are stored as values in the myRef column in the AB table.
>>>> Then when I retrieve a D (by accident also with id=1) from the
>>>> database it will also look in the AB table to see if any references
>>>> should be loaded. If finds the previously stored A as this record
>>>> has a column myRef with value 1. It loads this A but fails because
>>>> it expects B.
>>>>
>>>> The above example could also occur here because it fails when
>>>> loading a collection. You should set a breakpoint in hibernate to
>>>> check which exact instance is involved here and see which table
>>>> fields play a role. Based on that you (or I can help) can check
>>>> which part of the model is the cause and see if by adding
>>>> annotations this can be solved.
>>>>
>>>
>>> The problem seems to come from the mapping for the Debian metamodel
>>> (i.e. epackage) which is not correctly generated by Teneo: only the
>>> "ScriptDescriptions" class is well declared as a subclass of the
>>> "Field" one, whereas in the metamodel the
>>> "PackageDescriptions","Dependancy","PackageName" and "Version"
>>> classes are also subclasses of this one.
>>>
>>> This explains why it fails when trying to get from the database an
>>> instance of "PackageDescriptions","Dependancy","PackageName" or
>>> "Version" classes.
>>>
>>> I attached the Debian metamodel and the mapping file.
>>>
>>> Do you see why in this case the mapping is incomplete?
>>
>> What is strange is that the mapping generated by the first execution
>> of the test program (i.e. when adding the "debian_res_thunderbird"
>> model to the database) is good.
>>
>> But during the second execution of it (i.e. when trying to retrieve
>> the "debian_res_thunderbird" model from the database), the mapping
>> contains the previously described errors. However, when I try to
>> retrieve the "Debian" metamodel (i.e. the "Debian" epackage) and to
>> serialize it, it works well (the Ecore file describes the right
>> inheritance tree) ?!?
>>
>>>
>>> Best regards,
>>>
>>> Hugo
>>>
>>>> gr. Martin
>>>>
>>>> Hugo Bruneliere wrote:
>>>>> Hi,
>>>>>
>>>>> I'm having problems with models which conforms to metamodels
>>>>> containing inheritance hierarchy.
>>>>>
>>>>> The Debian metamodel and two sample models conforming to it are
>>>>> attached to this post.
>>>>>
>>>>> In a first execution, I store the metamodel and the two models
>>>>> using Teneo.
>>>>> Then in a second execution, I try to reload these models (still
>>>>> using Teneo) from the previously built database: I succeed in
>>>>> getting the Debian metamodel and the "res_firefox" model but I fail
>>>>> in getting the "res_thunderbird" model. The main difference between
>>>>> the two models is that the second one uses instances of classes
>>>>> which inherit attributes from another one. It seems to be the cause
>>>>> of the problem:
>>>>>
>>>>> Exception in thread "main" org.hibernate.WrongClassException:
>>>>> Object with id: 2 was not of the specified subclass: Field
>>>>> (Discriminator: Dependancy)
>>>>> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>>>> at
>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>>>> at
>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>>>> at
>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>>>
>>>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>>>> at
>>>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>>>
>>>>> at
>>>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>>>
>>>>> at
>>>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>>>
>>>>> at
>>>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>>>
>>>>> at
>>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>>>
>>>>> at
>>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>>
>>>>> at
>>>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>>>> at
>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>>>
>>>>>
>>>>>
>>>>> I took a look at the ecore_eobject table and the
>>>>> eclass_esupertypes_e_id field does not seem to be correctly
>>>>> initiated for the concerned Eclass of my Debian metamodel...
>>>>>
>>>>>
>>>>> How can I configure the mapping (and my datastore) to work properly?
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Hugo
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
>>> <hibernate-mapping auto-import="false">
>>> <class entity-name="debian.Deb" abstract="false" lazy="false"
>>> discriminator-value="debian.Deb" table="`debian_deb`">
>>> <meta attribute="eclassName">Deb</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="metadata" entity-name="debian.Databin"
>>> cascade="all" foreign-key="debian_deb_metadata" lazy="false"
>>> insert="true" update="true" unique="true"/>
>>> <one-to-one name="control" entity-name="debian.Archcontrol"
>>> foreign-key="debian_deb_control" cascade="all" property-ref="debc"
>>> lazy="false"/>
>>> <one-to-one name="data" entity-name="debian.Archdata"
>>> foreign-key="debian_deb_data" cascade="all" property-ref="debd"
>>> lazy="false"/>
>>> <property name="name" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`name`"/>
>>> </property>
>>> </class>
>>> <class entity-name="debian.Databin" abstract="false" lazy="false"
>>> discriminator-value="debian.Databin" table="`debian_databin`">
>>> <meta attribute="eclassName">Databin</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <one-to-one name="debpm" entity-name="debian.Deb"
>>> foreign-key="debian_databin_debpm"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> property-ref="metadata" lazy="false"/>
>>> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="debian_databin_blocs">
>>> <column name="`bloc_meta_e_id`" not-null="false"
>>> unique="false"/>
>>> </key>
>>> <one-to-many entity-name="debian.Bloc"/>
>>> </bag>
>>> </class>
>>> <class entity-name="debian.Bloc" abstract="false" lazy="false"
>>> discriminator-value="debian.Bloc" table="`debian_bloc`">
>>> <meta attribute="eclassName">Bloc</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="meta" entity-name="debian.Databin"
>>> foreign-key="debian_bloc_meta" lazy="false" insert="false"
>>> update="false" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`bloc_meta_e_id`"/>
>>> </many-to-one>
>>> <bag name="field" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="debian_bloc_field">
>>> <column name="`field_blocs_e_id`" not-null="false"
>>> unique="false"/>
>>> </key>
>>> <one-to-many entity-name="debian.Field"/>
>>> </bag>
>>> </class>
>>> <class entity-name="debian.Field" abstract="true" lazy="false"
>>> discriminator-value="debian.Field" table="`debian_field`">
>>> <meta attribute="eclassName">Field</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <property name="val" lazy="false" insert="true" update="true"
>>> not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`val`"/>
>>> </property>
>>> <property name="type" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`type`"/>
>>> </property>
>>> <many-to-one name="blocs" entity-name="debian.Bloc"
>>> foreign-key="debian_field_blocs" lazy="false" insert="false"
>>> update="false" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`field_blocs_e_id`"/>
>>> </many-to-one>
>>> </class>
>>> <class entity-name="debian.Version" abstract="false" lazy="false"
>>> discriminator-value="debian.Version" table="`debian_version`">
>>> <meta attribute="eclassName">Version</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <class entity-name="debian.PackageName" abstract="false"
>>> lazy="false" discriminator-value="debian.PackageName"
>>> table="`debian_packagename`">
>>> <meta attribute="eclassName">PackageName</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <class entity-name="debian.Dependancy" abstract="false"
>>> lazy="false" discriminator-value="debian.Dependancy"
>>> table="`debian_dependancy`">
>>> <meta attribute="eclassName">Dependancy</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <class entity-name="debian.PackageDescriptions" abstract="false"
>>> lazy="false" discriminator-value="debian.PackageDescriptions"
>>> table="`debian_packagedescriptions`">
>>> <meta attribute="eclassName">PackageDescriptions</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions"
>>> abstract="false" lazy="false" extends="debian.Field"
>>> discriminator-value="debian.ScriptDescriptions">
>>> <meta attribute="eclassName">ScriptDescriptions</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</meta>
>>> </subclass>
>>> <class entity-name="debian.Archcontrol" abstract="false"
>>> lazy="false" discriminator-value="debian.Archcontrol"
>>> table="`debian_archcontrol`">
>>> <meta attribute="eclassName">Archcontrol</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="debc" entity-name="debian.Deb"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> foreign-key="debian_archcontrol_debc" lazy="false" insert="true"
>>> update="true" unique="true"/>
>>> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="debian_archcontrol_scripts">
>>> <column name="`script_archscript_e_id`"
>>> not-null="false" unique="false"/>
>>> </key>
>>> <one-to-many entity-name="debian.Script"/>
>>> </bag>
>>> </class>
>>> <class entity-name="debian.Script" abstract="false" lazy="false"
>>> discriminator-value="debian.Script" table="`debian_script`">
>>> <meta attribute="eclassName">Script</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="archscript"
>>> entity-name="debian.Archcontrol"
>>> foreign-key="debian_script_archscript" lazy="false" insert="false"
>>> update="false" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`script_archscript_e_id`"/>
>>> </many-to-one>
>>> <property name="script_name" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false"
>>> name="`script_name`"/>
>>> </property>
>>> <property name="code" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`code`"/>
>>> </property>
>>> </class>
>>> <class entity-name="debian.Archdata" abstract="false"
>>> lazy="false" discriminator-value="debian.Archdata"
>>> table="`debian_archdata`">
>>> <meta attribute="eclassName">Archdata</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="debd" entity-name="debian.Deb"
>>> cascade="merge,persist,save-update,lock,refresh"
>>> foreign-key="debian_archdata_debd" lazy="false" insert="true"
>>> update="true" unique="true"/>
>>> <bag name="fil" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="debian_archdata_fil">
>>> <column name="`file_data_e_id`" not-null="false"
>>> unique="false"/>
>>> </key>
>>> <one-to-many entity-name="debian.File"/>
>>> </bag>
>>> <property name="name" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`name`"/>
>>> </property>
>>> </class>
>>> <class entity-name="debian.File" abstract="false" lazy="false"
>>> discriminator-value="debian.File" table="`debian_file`">
>>> <meta attribute="eclassName">File</meta>
>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>> <many-to-one name="data" entity-name="debian.Archdata"
>>> foreign-key="debian_file_data" lazy="false" insert="false"
>>> update="false" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`file_data_e_id`"/>
>>> </many-to-one>
>>> <property name="filename" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`filename`"/>
>>> </property>
>>> <property name="location" lazy="false" insert="true"
>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>> <column not-null="true" unique="false" name="`location`"/>
>>> </property>
>>> </class>
>>> </hibernate-mapping>
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <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="Debian" nsURI="my.model.of.debian.package"
>>> nsPrefix="debian">
>>> <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"
>>> eSuperTypes="#/1/Field"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="PackageName"
>>> eSuperTypes="#/1/Field"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>>> eSuperTypes="#/1/Field"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions"
>>> eSuperTypes="#/1/Field"/>
>>> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions"
>>> eSuperTypes="#/1/Field"/>
>>> <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>
>>
>>
>
>
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Re: [TENEO] Problem of mapping when inheritance hierarchy in a stored metamodel [message #609941 is a reply to message #98662] |
Tue, 09 October 2007 04:25  |
Eclipse User |
|
|
|
Hi Hugo,
I found the issue. Teneo does not identify the eSuperTypes eReference of EClass as a many-to-many
relation (an eclass like Field can be the supertype of more than one subtype, and one type can have
multiple supertypes). The association is not modeled in the db using a join-table but using
foreign-keys. Therefore only one sub-supertype relation is stored (the one from ScriptDescriptions).
An easy workaround is pass this option:
props.put(PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_AS SOCIATIONS, "true");
in this way all one-to-many relations can be used as many-to-many (in the db).
Another option (which is more work but allows you to do specific settings per association):
Create a separate xml file with annotations to tell Teneo that this relation is in fact a
many-to-many. I tested the following xml and it worked fine :
<?xml version="1.0" encoding="utf-8"?>
<persistence-mapping xmlns="http://www.eclipse.org/emft/teneo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<epackage namespace-uri="http://www.eclipse.org/emf/2002/Ecore">
<eclass name="EClass">
<property name="eSuperTypes">
<many-to-many/>
</property>
</eclass>
</epackage>
</persistence-mapping>
You can pass the xml like this to Teneo (set the PersistenceOptions.PERSISTENCE_XML property):
props.setProperty(PersistenceOptions.PERSISTENCE_XML,
"org/eclipse/emf/teneo/hibernate/test/test.persistence.xml");
btw, can you enter a bugzilla for this so that I incorporate this as standard in Teneo (specifically
for the ecore package)?
gr. Martin
Hugo Bruneliere wrote:
> Martin Taal a écrit :
>> Hi Hugo,
>> I tried it and yes the debian.ecore maps correctly. For my
>> understanding what you do is persist the debian.ecore itself also in
>> the db then retrieve it and then use this retrieved debian model to
>> create a hibernate mapping. Am I correct?
>> And this retrieved model does not contain the correct sub-type
>> super-type relations.
>
> Yes that's it. But what is strange is that when I serialize the debian
> model I retrieved, I obtain the same debian.ecore file as the original
> one. I can deduce that the debian.ecore model is well-stored and
> well-retrieved (with the right inheritance tree).
>
> After that I create a new hibernate data store in which I set the
> retrieved Debian EPackage in order to be able to create Debian models.
> But why does the mapping differ this time?
>
> Hugo
>
>>
>> gr. Martin
>>
>> Hugo Bruneliere wrote:
>>> Hugo Bruneliere a écrit :
>>>> Hi Martin,
>>>>
>>>> Martin Taal a écrit :
>>>>> Hi Hugo,
>>>>> This can occur if there are nameclashes.
>>>>>
>>>>> For example assume a small hierarchy: type A inherits from B, and
>>>>> there are two other types C and D, both have a list efeature called
>>>>> myRef, C refers to A and D refers to B. Assume that single-class
>>>>> inheritance mapping is used (so inheritance structure is stored in
>>>>> one table) then A and B are both stored in one table. Then when I
>>>>> create a C (with id=1) with myRef references to A then these
>>>>> references are stored as values in the myRef column in the AB
>>>>> table. Then when I retrieve a D (by accident also with id=1) from
>>>>> the database it will also look in the AB table to see if any
>>>>> references should be loaded. If finds the previously stored A as
>>>>> this record has a column myRef with value 1. It loads this A but
>>>>> fails because it expects B.
>>>>>
>>>>> The above example could also occur here because it fails when
>>>>> loading a collection. You should set a breakpoint in hibernate to
>>>>> check which exact instance is involved here and see which table
>>>>> fields play a role. Based on that you (or I can help) can check
>>>>> which part of the model is the cause and see if by adding
>>>>> annotations this can be solved.
>>>>>
>>>>
>>>> The problem seems to come from the mapping for the Debian metamodel
>>>> (i.e. epackage) which is not correctly generated by Teneo: only the
>>>> "ScriptDescriptions" class is well declared as a subclass of the
>>>> "Field" one, whereas in the metamodel the
>>>> "PackageDescriptions","Dependancy","PackageName" and "Version"
>>>> classes are also subclasses of this one.
>>>>
>>>> This explains why it fails when trying to get from the database an
>>>> instance of "PackageDescriptions","Dependancy","PackageName" or
>>>> "Version" classes.
>>>>
>>>> I attached the Debian metamodel and the mapping file.
>>>>
>>>> Do you see why in this case the mapping is incomplete?
>>>
>>> What is strange is that the mapping generated by the first execution
>>> of the test program (i.e. when adding the "debian_res_thunderbird"
>>> model to the database) is good.
>>>
>>> But during the second execution of it (i.e. when trying to retrieve
>>> the "debian_res_thunderbird" model from the database), the mapping
>>> contains the previously described errors. However, when I try to
>>> retrieve the "Debian" metamodel (i.e. the "Debian" epackage) and to
>>> serialize it, it works well (the Ecore file describes the right
>>> inheritance tree) ?!?
>>>
>>>>
>>>> Best regards,
>>>>
>>>> Hugo
>>>>
>>>>> gr. Martin
>>>>>
>>>>> Hugo Bruneliere wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm having problems with models which conforms to metamodels
>>>>>> containing inheritance hierarchy.
>>>>>>
>>>>>> The Debian metamodel and two sample models conforming to it are
>>>>>> attached to this post.
>>>>>>
>>>>>> In a first execution, I store the metamodel and the two models
>>>>>> using Teneo.
>>>>>> Then in a second execution, I try to reload these models (still
>>>>>> using Teneo) from the previously built database: I succeed in
>>>>>> getting the Debian metamodel and the "res_firefox" model but I
>>>>>> fail in getting the "res_thunderbird" model. The main difference
>>>>>> between the two models is that the second one uses instances of
>>>>>> classes which inherit attributes from another one. It seems to be
>>>>>> the cause of the problem:
>>>>>>
>>>>>> Exception in thread "main" org.hibernate.WrongClassException:
>>>>>> Object with id: 2 was not of the specified subclass: Field
>>>>>> (Discriminator: Dependancy)
>>>>>> at org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>>>>> at
>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>>>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>>>>> at
>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>>>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>>>>> at
>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>>>>
>>>>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>>>>> at
>>>>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>>>
>>>>>> at
>>>>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>>>>
>>>>>>
>>>>>>
>>>>>> I took a look at the ecore_eobject table and the
>>>>>> eclass_esupertypes_e_id field does not seem to be correctly
>>>>>> initiated for the concerned Eclass of my Debian metamodel...
>>>>>>
>>>>>>
>>>>>> How can I configure the mapping (and my datastore) to work properly?
>>>>>>
>>>>>> Thanks in advance,
>>>>>>
>>>>>> Hugo
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------ ------------
>>>>
>>>>
>>>> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
>>>> <hibernate-mapping auto-import="false">
>>>> <class entity-name="debian.Deb" abstract="false" lazy="false"
>>>> discriminator-value="debian.Deb" table="`debian_deb`">
>>>> <meta attribute="eclassName">Deb</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="metadata" entity-name="debian.Databin"
>>>> cascade="all" foreign-key="debian_deb_metadata" lazy="false"
>>>> insert="true" update="true" unique="true"/>
>>>> <one-to-one name="control" entity-name="debian.Archcontrol"
>>>> foreign-key="debian_deb_control" cascade="all" property-ref="debc"
>>>> lazy="false"/>
>>>> <one-to-one name="data" entity-name="debian.Archdata"
>>>> foreign-key="debian_deb_data" cascade="all" property-ref="debd"
>>>> lazy="false"/>
>>>> <property name="name" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`name`"/>
>>>> </property>
>>>> </class>
>>>> <class entity-name="debian.Databin" abstract="false"
>>>> lazy="false" discriminator-value="debian.Databin"
>>>> table="`debian_databin`">
>>>> <meta attribute="eclassName">Databin</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <one-to-one name="debpm" entity-name="debian.Deb"
>>>> foreign-key="debian_databin_debpm"
>>>> cascade="merge,persist,save-update,lock,refresh"
>>>> property-ref="metadata" lazy="false"/>
>>>> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="debian_databin_blocs">
>>>> <column name="`bloc_meta_e_id`" not-null="false"
>>>> unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="debian.Bloc"/>
>>>> </bag>
>>>> </class>
>>>> <class entity-name="debian.Bloc" abstract="false" lazy="false"
>>>> discriminator-value="debian.Bloc" table="`debian_bloc`">
>>>> <meta attribute="eclassName">Bloc</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="meta" entity-name="debian.Databin"
>>>> foreign-key="debian_bloc_meta" lazy="false" insert="false"
>>>> update="false" not-null="false">
>>>> <column not-null="false" unique="false"
>>>> name="`bloc_meta_e_id`"/>
>>>> </many-to-one>
>>>> <bag name="field" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="debian_bloc_field">
>>>> <column name="`field_blocs_e_id`" not-null="false"
>>>> unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="debian.Field"/>
>>>> </bag>
>>>> </class>
>>>> <class entity-name="debian.Field" abstract="true" lazy="false"
>>>> discriminator-value="debian.Field" table="`debian_field`">
>>>> <meta attribute="eclassName">Field</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <property name="val" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`val`"/>
>>>> </property>
>>>> <property name="type" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`type`"/>
>>>> </property>
>>>> <many-to-one name="blocs" entity-name="debian.Bloc"
>>>> foreign-key="debian_field_blocs" lazy="false" insert="false"
>>>> update="false" not-null="false">
>>>> <column not-null="false" unique="false"
>>>> name="`field_blocs_e_id`"/>
>>>> </many-to-one>
>>>> </class>
>>>> <class entity-name="debian.Version" abstract="false"
>>>> lazy="false" discriminator-value="debian.Version"
>>>> table="`debian_version`">
>>>> <meta attribute="eclassName">Version</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <class entity-name="debian.PackageName" abstract="false"
>>>> lazy="false" discriminator-value="debian.PackageName"
>>>> table="`debian_packagename`">
>>>> <meta attribute="eclassName">PackageName</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <class entity-name="debian.Dependancy" abstract="false"
>>>> lazy="false" discriminator-value="debian.Dependancy"
>>>> table="`debian_dependancy`">
>>>> <meta attribute="eclassName">Dependancy</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <class entity-name="debian.PackageDescriptions" abstract="false"
>>>> lazy="false" discriminator-value="debian.PackageDescriptions"
>>>> table="`debian_packagedescriptions`">
>>>> <meta attribute="eclassName">PackageDescriptions</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions"
>>>> abstract="false" lazy="false" extends="debian.Field"
>>>> discriminator-value="debian.ScriptDescriptions">
>>>> <meta attribute="eclassName">ScriptDescriptions</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</meta>
>>>> </subclass>
>>>> <class entity-name="debian.Archcontrol" abstract="false"
>>>> lazy="false" discriminator-value="debian.Archcontrol"
>>>> table="`debian_archcontrol`">
>>>> <meta attribute="eclassName">Archcontrol</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="debc" entity-name="debian.Deb"
>>>> cascade="merge,persist,save-update,lock,refresh"
>>>> foreign-key="debian_archcontrol_debc" lazy="false" insert="true"
>>>> update="true" unique="true"/>
>>>> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true"
>>>> foreign-key="debian_archcontrol_scripts">
>>>> <column name="`script_archscript_e_id`"
>>>> not-null="false" unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="debian.Script"/>
>>>> </bag>
>>>> </class>
>>>> <class entity-name="debian.Script" abstract="false" lazy="false"
>>>> discriminator-value="debian.Script" table="`debian_script`">
>>>> <meta attribute="eclassName">Script</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="archscript"
>>>> entity-name="debian.Archcontrol"
>>>> foreign-key="debian_script_archscript" lazy="false" insert="false"
>>>> update="false" not-null="false">
>>>> <column not-null="false" unique="false"
>>>> name="`script_archscript_e_id`"/>
>>>> </many-to-one>
>>>> <property name="script_name" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false"
>>>> name="`script_name`"/>
>>>> </property>
>>>> <property name="code" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`code`"/>
>>>> </property>
>>>> </class>
>>>> <class entity-name="debian.Archdata" abstract="false"
>>>> lazy="false" discriminator-value="debian.Archdata"
>>>> table="`debian_archdata`">
>>>> <meta attribute="eclassName">Archdata</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="debd" entity-name="debian.Deb"
>>>> cascade="merge,persist,save-update,lock,refresh"
>>>> foreign-key="debian_archdata_debd" lazy="false" insert="true"
>>>> update="true" unique="true"/>
>>>> <bag name="fil" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="debian_archdata_fil">
>>>> <column name="`file_data_e_id`" not-null="false"
>>>> unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="debian.File"/>
>>>> </bag>
>>>> <property name="name" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`name`"/>
>>>> </property>
>>>> </class>
>>>> <class entity-name="debian.File" abstract="false" lazy="false"
>>>> discriminator-value="debian.File" table="`debian_file`">
>>>> <meta attribute="eclassName">File</meta>
>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>> <many-to-one name="data" entity-name="debian.Archdata"
>>>> foreign-key="debian_file_data" lazy="false" insert="false"
>>>> update="false" not-null="false">
>>>> <column not-null="false" unique="false"
>>>> name="`file_data_e_id`"/>
>>>> </many-to-one>
>>>> <property name="filename" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`filename`"/>
>>>> </property>
>>>> <property name="location" lazy="false" insert="true"
>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>> <column not-null="true" unique="false" name="`location`"/>
>>>> </property>
>>>> </class>
>>>> </hibernate-mapping>
>>>>
>>>>
>>>> ------------------------------------------------------------ ------------
>>>>
>>>>
>>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>> <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="Debian" nsURI="my.model.of.debian.package"
>>>> nsPrefix="debian">
>>>> <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"
>>>> eSuperTypes="#/1/Field"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="PackageName"
>>>> eSuperTypes="#/1/Field"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>>>> eSuperTypes="#/1/Field"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="PackageDescriptions"
>>>> eSuperTypes="#/1/Field"/>
>>>> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions"
>>>> eSuperTypes="#/1/Field"/>
>>>> <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>
>>>
>>>
>>
>>
>
>
--
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] Problem of mapping when inheritance hierarchy in a stored metamodel [message #609943 is a reply to message #98740] |
Tue, 09 October 2007 05:25  |
Eclipse User |
|
|
|
Hi Martin,
Martin Taal a écrit :
> Hi Hugo,
> I found the issue. Teneo does not identify the eSuperTypes eReference of
> EClass as a many-to-many relation (an eclass like Field can be the
> supertype of more than one subtype, and one type can have multiple
> supertypes). The association is not modeled in the db using a join-table
> but using foreign-keys. Therefore only one sub-supertype relation is
> stored (the one from ScriptDescriptions).
>
> An easy workaround is pass this option:
> props.put(PersistenceOptions.JOIN_TABLE_FOR_NON_CONTAINED_AS SOCIATIONS,
> "true");
> in this way all one-to-many relations can be used as many-to-many (in
> the db).
>
> Another option (which is more work but allows you to do specific
> settings per association):
> Create a separate xml file with annotations to tell Teneo that this
> relation is in fact a many-to-many. I tested the following xml and it
> worked fine :
> <?xml version="1.0" encoding="utf-8"?>
> <persistence-mapping xmlns="http://www.eclipse.org/emft/teneo"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <epackage namespace-uri="http://www.eclipse.org/emf/2002/Ecore">
> <eclass name="EClass">
> <property name="eSuperTypes">
> <many-to-many/>
> </property>
> </eclass>
> </epackage>
> </persistence-mapping>
>
> You can pass the xml like this to Teneo (set the
> PersistenceOptions.PERSISTENCE_XML property):
> props.setProperty(PersistenceOptions.PERSISTENCE_XML,
> "org/eclipse/emf/teneo/hibernate/test/test.persistence.xml");
>
> btw, can you enter a bugzilla for this so that I incorporate this as
> standard in Teneo (specifically for the ecore package)?
>
Thanks a lot, this solves my problem! In my opinion, integrating this
into the standard Teneo is a good idea as this case may be encountered
very frequently when dealing with elaborated Ecore models.
As you requested, here is the bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205790
Best regards,
Hugo
> gr. Martin
>
> Hugo Bruneliere wrote:
>> Martin Taal a écrit :
>>> Hi Hugo,
>>> I tried it and yes the debian.ecore maps correctly. For my
>>> understanding what you do is persist the debian.ecore itself also in
>>> the db then retrieve it and then use this retrieved debian model to
>>> create a hibernate mapping. Am I correct?
>>> And this retrieved model does not contain the correct sub-type
>>> super-type relations.
>>
>> Yes that's it. But what is strange is that when I serialize the debian
>> model I retrieved, I obtain the same debian.ecore file as the original
>> one. I can deduce that the debian.ecore model is well-stored and
>> well-retrieved (with the right inheritance tree).
>>
>> After that I create a new hibernate data store in which I set the
>> retrieved Debian EPackage in order to be able to create Debian models.
>> But why does the mapping differ this time?
>>
>> Hugo
>>
>>>
>>> gr. Martin
>>>
>>> Hugo Bruneliere wrote:
>>>> Hugo Bruneliere a écrit :
>>>>> Hi Martin,
>>>>>
>>>>> Martin Taal a écrit :
>>>>>> Hi Hugo,
>>>>>> This can occur if there are nameclashes.
>>>>>>
>>>>>> For example assume a small hierarchy: type A inherits from B, and
>>>>>> there are two other types C and D, both have a list efeature
>>>>>> called myRef, C refers to A and D refers to B. Assume that
>>>>>> single-class inheritance mapping is used (so inheritance structure
>>>>>> is stored in one table) then A and B are both stored in one table.
>>>>>> Then when I create a C (with id=1) with myRef references to A then
>>>>>> these references are stored as values in the myRef column in the
>>>>>> AB table. Then when I retrieve a D (by accident also with id=1)
>>>>>> from the database it will also look in the AB table to see if any
>>>>>> references should be loaded. If finds the previously stored A as
>>>>>> this record has a column myRef with value 1. It loads this A but
>>>>>> fails because it expects B.
>>>>>>
>>>>>> The above example could also occur here because it fails when
>>>>>> loading a collection. You should set a breakpoint in hibernate to
>>>>>> check which exact instance is involved here and see which table
>>>>>> fields play a role. Based on that you (or I can help) can check
>>>>>> which part of the model is the cause and see if by adding
>>>>>> annotations this can be solved.
>>>>>>
>>>>>
>>>>> The problem seems to come from the mapping for the Debian metamodel
>>>>> (i.e. epackage) which is not correctly generated by Teneo: only the
>>>>> "ScriptDescriptions" class is well declared as a subclass of the
>>>>> "Field" one, whereas in the metamodel the
>>>>> "PackageDescriptions","Dependancy","PackageName" and "Version"
>>>>> classes are also subclasses of this one.
>>>>>
>>>>> This explains why it fails when trying to get from the database an
>>>>> instance of "PackageDescriptions","Dependancy","PackageName" or
>>>>> "Version" classes.
>>>>>
>>>>> I attached the Debian metamodel and the mapping file.
>>>>>
>>>>> Do you see why in this case the mapping is incomplete?
>>>>
>>>> What is strange is that the mapping generated by the first execution
>>>> of the test program (i.e. when adding the "debian_res_thunderbird"
>>>> model to the database) is good.
>>>>
>>>> But during the second execution of it (i.e. when trying to retrieve
>>>> the "debian_res_thunderbird" model from the database), the mapping
>>>> contains the previously described errors. However, when I try to
>>>> retrieve the "Debian" metamodel (i.e. the "Debian" epackage) and to
>>>> serialize it, it works well (the Ecore file describes the right
>>>> inheritance tree) ?!?
>>>>
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Hugo
>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Hugo Bruneliere wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm having problems with models which conforms to metamodels
>>>>>>> containing inheritance hierarchy.
>>>>>>>
>>>>>>> The Debian metamodel and two sample models conforming to it are
>>>>>>> attached to this post.
>>>>>>>
>>>>>>> In a first execution, I store the metamodel and the two models
>>>>>>> using Teneo.
>>>>>>> Then in a second execution, I try to reload these models (still
>>>>>>> using Teneo) from the previously built database: I succeed in
>>>>>>> getting the Debian metamodel and the "res_firefox" model but I
>>>>>>> fail in getting the "res_thunderbird" model. The main difference
>>>>>>> between the two models is that the second one uses instances of
>>>>>>> classes which inherit attributes from another one. It seems to be
>>>>>>> the cause of the problem:
>>>>>>>
>>>>>>> Exception in thread "main" org.hibernate.WrongClassException:
>>>>>>> Object with id: 2 was not of the specified subclass: Field
>>>>>>> (Discriminator: Dependancy)
>>>>>>> at
>>>>>>> org.hibernate.loader.Loader.getInstanceClass(Loader.java:144 4)
>>>>>>> at
>>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java :1275)
>>>>>>> at org.hibernate.loader.Loader.getRow(Loader.java:1197)
>>>>>>> at
>>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 568)
>>>>>>> at org.hibernate.loader.Loader.doQuery(Loader.java:689)
>>>>>>> at
>>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>>>>>
>>>>>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>>>>>> at
>>>>>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollect ionEventListener.onInitializeCollection(EMFInitializeCollect ionEventListener.java:61)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>>>>>
>>>>>>> at
>>>>>>> org.hibernate.collection.PersistentBag.toArray(PersistentBag .java:257)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:137)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIsEmpty(PersistableEList.java:368)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.common.util.DelegatingEList.isEmpty(Delegati ngEList.java:241)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.isSet(Delega tingEcoreEList.java:584)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicIsSet(EStructuralFeatureImpl.java:1 708)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1240)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1143)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1181)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedSing le(XMLSaveImpl.java:2277)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1458)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>>>>>>>
>>>>>>> at
>>>>>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I took a look at the ecore_eobject table and the
>>>>>>> eclass_esupertypes_e_id field does not seem to be correctly
>>>>>>> initiated for the concerned Eclass of my Debian metamodel...
>>>>>>>
>>>>>>>
>>>>>>> How can I configure the mapping (and my datastore) to work properly?
>>>>>>>
>>>>>>> Thanks in advance,
>>>>>>>
>>>>>>> Hugo
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------ ------------
>>>>>
>>>>>
>>>>> <?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 Mon Oct 08 14:56:02 CEST 2007 -->
>>>>> <hibernate-mapping auto-import="false">
>>>>> <class entity-name="debian.Deb" abstract="false" lazy="false"
>>>>> discriminator-value="debian.Deb" table="`debian_deb`">
>>>>> <meta attribute="eclassName">Deb</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="metadata" entity-name="debian.Databin"
>>>>> cascade="all" foreign-key="debian_deb_metadata" lazy="false"
>>>>> insert="true" update="true" unique="true"/>
>>>>> <one-to-one name="control" entity-name="debian.Archcontrol"
>>>>> foreign-key="debian_deb_control" cascade="all" property-ref="debc"
>>>>> lazy="false"/>
>>>>> <one-to-one name="data" entity-name="debian.Archdata"
>>>>> foreign-key="debian_deb_data" cascade="all" property-ref="debd"
>>>>> lazy="false"/>
>>>>> <property name="name" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`name`"/>
>>>>> </property>
>>>>> </class>
>>>>> <class entity-name="debian.Databin" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Databin"
>>>>> table="`debian_databin`">
>>>>> <meta attribute="eclassName">Databin</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <one-to-one name="debpm" entity-name="debian.Deb"
>>>>> foreign-key="debian_databin_debpm"
>>>>> cascade="merge,persist,save-update,lock,refresh"
>>>>> property-ref="metadata" lazy="false"/>
>>>>> <bag name="blocs" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true" foreign-key="debian_databin_blocs">
>>>>> <column name="`bloc_meta_e_id`" not-null="false"
>>>>> unique="false"/>
>>>>> </key>
>>>>> <one-to-many entity-name="debian.Bloc"/>
>>>>> </bag>
>>>>> </class>
>>>>> <class entity-name="debian.Bloc" abstract="false" lazy="false"
>>>>> discriminator-value="debian.Bloc" table="`debian_bloc`">
>>>>> <meta attribute="eclassName">Bloc</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="meta" entity-name="debian.Databin"
>>>>> foreign-key="debian_bloc_meta" lazy="false" insert="false"
>>>>> update="false" not-null="false">
>>>>> <column not-null="false" unique="false"
>>>>> name="`bloc_meta_e_id`"/>
>>>>> </many-to-one>
>>>>> <bag name="field" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true" foreign-key="debian_bloc_field">
>>>>> <column name="`field_blocs_e_id`" not-null="false"
>>>>> unique="false"/>
>>>>> </key>
>>>>> <one-to-many entity-name="debian.Field"/>
>>>>> </bag>
>>>>> </class>
>>>>> <class entity-name="debian.Field" abstract="true" lazy="false"
>>>>> discriminator-value="debian.Field" table="`debian_field`">
>>>>> <meta attribute="eclassName">Field</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <property name="val" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`val`"/>
>>>>> </property>
>>>>> <property name="type" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`type`"/>
>>>>> </property>
>>>>> <many-to-one name="blocs" entity-name="debian.Bloc"
>>>>> foreign-key="debian_field_blocs" lazy="false" insert="false"
>>>>> update="false" not-null="false">
>>>>> <column not-null="false" unique="false"
>>>>> name="`field_blocs_e_id`"/>
>>>>> </many-to-one>
>>>>> </class>
>>>>> <class entity-name="debian.Version" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Version"
>>>>> table="`debian_version`">
>>>>> <meta attribute="eclassName">Version</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <class entity-name="debian.PackageName" abstract="false"
>>>>> lazy="false" discriminator-value="debian.PackageName"
>>>>> table="`debian_packagename`">
>>>>> <meta attribute="eclassName">PackageName</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <class entity-name="debian.Dependancy" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Dependancy"
>>>>> table="`debian_dependancy`">
>>>>> <meta attribute="eclassName">Dependancy</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <class entity-name="debian.PackageDescriptions"
>>>>> abstract="false" lazy="false"
>>>>> discriminator-value="debian.PackageDescriptions"
>>>>> table="`debian_packagedescriptions`">
>>>>> <meta attribute="eclassName">PackageDescriptions</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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 entity-name="debian.ScriptDescriptions"
>>>>> abstract="false" lazy="false" extends="debian.Field"
>>>>> discriminator-value="debian.ScriptDescriptions">
>>>>> <meta attribute="eclassName">ScriptDescriptions</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</meta>
>>>>> </subclass>
>>>>> <class entity-name="debian.Archcontrol" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Archcontrol"
>>>>> table="`debian_archcontrol`">
>>>>> <meta attribute="eclassName">Archcontrol</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="debc" entity-name="debian.Deb"
>>>>> cascade="merge,persist,save-update,lock,refresh"
>>>>> foreign-key="debian_archcontrol_debc" lazy="false" insert="true"
>>>>> update="true" unique="true"/>
>>>>> <bag name="scripts" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true"
>>>>> foreign-key="debian_archcontrol_scripts">
>>>>> <column name="`script_archscript_e_id`"
>>>>> not-null="false" unique="false"/>
>>>>> </key>
>>>>> <one-to-many entity-name="debian.Script"/>
>>>>> </bag>
>>>>> </class>
>>>>> <class entity-name="debian.Script" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Script"
>>>>> table="`debian_script`">
>>>>> <meta attribute="eclassName">Script</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="archscript"
>>>>> entity-name="debian.Archcontrol"
>>>>> foreign-key="debian_script_archscript" lazy="false" insert="false"
>>>>> update="false" not-null="false">
>>>>> <column not-null="false" unique="false"
>>>>> name="`script_archscript_e_id`"/>
>>>>> </many-to-one>
>>>>> <property name="script_name" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false"
>>>>> name="`script_name`"/>
>>>>> </property>
>>>>> <property name="code" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`code`"/>
>>>>> </property>
>>>>> </class>
>>>>> <class entity-name="debian.Archdata" abstract="false"
>>>>> lazy="false" discriminator-value="debian.Archdata"
>>>>> table="`debian_archdata`">
>>>>> <meta attribute="eclassName">Archdata</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="debd" entity-name="debian.Deb"
>>>>> cascade="merge,persist,save-update,lock,refresh"
>>>>> foreign-key="debian_archdata_debd" lazy="false" insert="true"
>>>>> update="true" unique="true"/>
>>>>> <bag name="fil" lazy="true" cascade="all,delete-orphan">
>>>>> <key update="true" foreign-key="debian_archdata_fil">
>>>>> <column name="`file_data_e_id`" not-null="false"
>>>>> unique="false"/>
>>>>> </key>
>>>>> <one-to-many entity-name="debian.File"/>
>>>>> </bag>
>>>>> <property name="name" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`name`"/>
>>>>> </property>
>>>>> </class>
>>>>> <class entity-name="debian.File" abstract="false" lazy="false"
>>>>> discriminator-value="debian.File" table="`debian_file`">
>>>>> <meta attribute="eclassName">File</meta>
>>>>> <meta attribute="epackage">my.model.of.debian.package</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>
>>>>> <many-to-one name="data" entity-name="debian.Archdata"
>>>>> foreign-key="debian_file_data" lazy="false" insert="false"
>>>>> update="false" not-null="false">
>>>>> <column not-null="false" unique="false"
>>>>> name="`file_data_e_id`"/>
>>>>> </many-to-one>
>>>>> <property name="filename" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`filename`"/>
>>>>> </property>
>>>>> <property name="location" lazy="false" insert="true"
>>>>> update="true" not-null="true" unique="false" type="java.lang.String">
>>>>> <column not-null="true" unique="false" name="`location`"/>
>>>>> </property>
>>>>> </class>
>>>>> </hibernate-mapping>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------ ------------
>>>>>
>>>>>
>>>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>>> <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="Debian" nsURI="my.model.of.debian.package"
>>>>> nsPrefix="debian">
>>>>> <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"
>>>>> eSuperTypes="#/1/Field"/>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="PackageName"
>>>>> eSuperTypes="#/1/Field"/>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Dependancy"
>>>>> eSuperTypes="#/1/Field"/>
>>>>> <eClassifiers xsi:type="ecore:EClass"
>>>>> name="PackageDescriptions" eSuperTypes="#/1/Field"/>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="ScriptDescriptions"
>>>>> eSuperTypes="#/1/Field"/>
>>>>> <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>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Goto Forum:
Current Time: Sat May 10 10:23:21 EDT 2025
Powered by FUDForum. Page generated in 0.06265 seconds
|