Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 #609874] Wed, 03 October 2007 16:19
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
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--


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Previous Topic:Emfatic, Gymnast and ANTLR
Next Topic:Teneo and Named Queries
Goto Forum:
  


Current Time: Fri Mar 29 10:48:22 GMT 2024

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

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

Back to the top