Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] How to model a map?
[Teneo] How to model a map? [message #423053] Mon, 22 September 2008 11:07 Go to next message
Eclipse UserFriend
Originally posted by: luzi.anderegg.ergon.ch

I modelled a map in my ecore according to
http://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF .3F. If I
use this map in my program, a MappingException arises? Is there anything
special with maps and teneo? Do I have to annotate my ecore?

Regards,
Luzi
Re: [Teneo] How to model a map? [message #423054 is a reply to message #423053] Mon, 22 September 2008 11:20 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030705080105020905060908
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi Luzi,
Yes maps should work. There are two ways in which Teneo can map maps:
- as a list of map entries (key, value pair), in this case the hibernate mapping will have a list as
the association
- as a real map (so with a map tag in the hbm).

If you set the option PersistenceOptions.EMAP_AS_TRUE_MAP to false (default is true) then Teneo will
map your emap as a list.

Attached you can find an example of an emap from the Teneo testcases.

Can you post your ecore and the resulting hbm?

gr. Martin

Luzi Anderegg wrote:
> I modelled a map in my ecore according to
> http://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF .3F. If I
> use this map in my program, a MappingException arises? Is there anything
> special with maps and teneo? Do I have to annotate my ecore?
>
> Regards,
> Luzi


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org

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

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage 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" name="emap"
nsURI=" http://www.eclipse.org/emf/teneo/samples/emf/schemaconstruct s/emap" nsPrefix="emap">
<eClassifiers xsi:type="ecore:EClass" name="Book">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Book"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="title" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="title"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="writers" upperBound="-1"
eType="#//StringToWriterMapEntry" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="writers"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="keyWords" upperBound="-1"
eType="#//StringToStringMapEntry" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="keyWords"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="cityByWriter" upperBound="-1"
eType="#//WriterToStringMapEntry" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="cityByWriter"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="categoryByDate" upperBound="-1"
eType="#//DateToCategoryMapEntry" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="categoryByDate"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="Category">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Category"/>
</eAnnotations>
<eLiterals name="Complex"/>
<eLiterals name="Simple" value="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="CategoryObject" instanceClassName="org.eclipse.emf.common.util.Enumerator">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Category:Object"/>
<details key="baseType" value="Category"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="Date" instanceClassName="java.util.Date">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Date"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DateToCategoryMapEntry" instanceClassName="java.util.Map$Entry">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="dateToCategoryMapEntry"/>
<details key="kind" value="empty"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="#//Date">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="key"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="#//Category"
defaultValueLiteral="Complex" unsettable="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="value"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="StringToStringMapEntry" instanceClassName="java.util.Map$Entry">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="StringToStringMapEntry"/>
<details key="kind" value="empty"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="key"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="value"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="StringToWriterMapEntry" instanceClassName="java.util.Map$Entry">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="StringToWriterMapEntry"/>
<details key="kind" value="empty"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="key"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="value" eType="#//Writer"
resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="value"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Writer">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Writer"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="name"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WriterToStringMapEntry" instanceClassName="java.util.Map$Entry">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="WriterToStringMapEntry"/>
<details key="kind" value="empty"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="key" eType="#//Writer"
resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="key"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="value"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>

--------------030705080105020905060908
Content-Type: text/xml;
name="emap.xsd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="emap.xsd"

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace=" http://www.eclipse.org/emf/teneo/samples/emf/schemaconstruct s/emap"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns=" http://www.eclipse.org/emf/teneo/samples/emf/schemaconstruct s/emap"
>

<xsd:complexType name="Book">
<xsd:sequence>
<xsd:element name="title" type="xsd:string" />
<xsd:element maxOccurs="unbounded" minOccurs="0" name="writers"
type="StringToWriterMapEntry"
/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="keyWords"
type="StringToStringMapEntry"
/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="cityByWriter"
type="WriterToStringMapEntry"
/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="categoryByDate"
type="dateToCategoryMapEntry"
/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="Writer">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType ecore:instanceClass="java.util.Map$Entry" name="StringToWriterMapEntry">
<xsd:attribute name="key" type="xsd:string" />
<xsd:attribute name="value" type="xsd:IDREF" ecore:reference="Writer" />
</xsd:complexType>

<xsd:complexType ecore:instanceClass="java.util.Map$Entry" name="WriterToStringMapEntry">
<xsd:attribute name="key" type="xsd:IDREF" ecore:reference="Writer" />
<xsd:attribute name="value" type="xsd:string" />
</xsd:complexType>

<xsd:complexType ecore:instanceClass="java.util.Map$Entry" name="StringToStringMapEntry">
<xsd:attribute name="key" type="xsd:string" />
<xsd:attribute name="value" type="xsd:string" />
</xsd:complexType>

<xsd:simpleType ecore:instanceClass="java.util.Date" name="Date">
<xsd:restriction base="xsd:dateTime"/>
</xsd:simpleType>

<xsd:complexType ecore:instanceClass="java.util.Map$Entry" name="dateToCategoryMapEntry">
<xsd:attribute name="key" type="Date" />
<xsd:attribute name="value" type="Category" />
</xsd:complexType>

<xsd:simpleType name="Category">
<xsd:restriction base="xsd:NCName">
<xsd:enumeration value="Complex"/>
<xsd:enumeration value="Simple"/>
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>

--------------030705080105020905060908
Content-Type: text/xml;
name="EMapAction_mysql_a_o_hibernate.hbm.xml"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="EMapAction_mysql_a_o_hibernate.hbm.xml"

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NU WVBFIGhpYmVy
bmF0ZS1tYXBwaW5nIFBVQkxJQyAiLS8vSGliZXJuYXRlL0hpYmVybmF0ZSBN YXBwaW5nIERU
RCAzLjAvL0VOIiAiaHR0cDovL2hpYmVybmF0ZS5zb3VyY2Vmb3JnZS5uZXQv aGliZXJuYXRl
LW1hcHBpbmctMy4wLmR0ZCI+Cgo8aGliZXJuYXRlLW1hcHBpbmcgYXV0by1p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0aXZlIi8+CgkJPC9pZD4KCQk8ZGlzY3JpbWlu YXRvciBjb2x1
bW49ImBkdHlwZWAiIHR5cGU9InN0cmluZyIvPgoJCTx2ZXJzaW9uIG5hbWU9 ImVfdmVyc2lv
biIgY29sdW1uPSJlX3ZlcnNpb24iIGFjY2Vzcz0ib3JnLmVjbGlwc2UuZW1m LnRlbmVvLmhp
YmVybmF0ZS5tYXBwaW5nLnByb3BlcnR5LlZlcnNpb25Qcm9wZXJ0eUhhbmRs ZXIiPgoJCQk8
bWV0YSBhdHRyaWJ1dGU9InN5bnRoZXRpY1ZlcnNpb24iPnRydWU8L21ldGE+ CgkJPC92ZXJz
aW9uPgoJCTxwcm9wZXJ0eSBuYW1lPSJuYW1lIiBsYXp5PSJmYWxzZSIgaW5z ZXJ0PSJ0cnVl
IiB1cGRhdGU9InRydWUiIG5vdC1udWxsPSJ0cnVlIiB1bmlxdWU9ImZhbHNl IiB0eXBlPSJq
YXZhLmxhbmcuU3RyaW5nIj4KCQkJPGNvbHVtbiBub3QtbnVsbD0idHJ1ZSIg dW5pcXVlPSJm
YWxzZSIgbmFtZT0iYG5hbWVgIi8+CgkJPC9wcm9wZXJ0eT4KCTwvY2xhc3M+ CjwvaGliZXJu
YXRlLW1hcHBpbmc+
--------------030705080105020905060908--
Re: [Teneo] How to model a map? [message #423061 is a reply to message #423054] Mon, 22 September 2008 14:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: luzi.anderegg.ergon.ch

Unfortunately, I'm not allowed to post the whole ecore. Below you find
the parts containing the map:

<eClassifiers xsi:type="ecore:EClass" name="IntegerToToolPinMapEntry"
instanceClassName="java.util.Map$Entry">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="key"
eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="value"
eType="#//ToolPin"
containment="true"/>
</eClassifiers>

and the referencing class:

<eClassifiers xsi:type="ecore:EClass" name="ToolElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="inputPins"
upperBound="-1"
eType="#//IntegerToToolPinMapEntry" containment="true"/>
</eClassifiers>

Luzi

Martin Taal wrote:
> Hi Luzi,
> Yes maps should work. There are two ways in which Teneo can map maps:
> - as a list of map entries (key, value pair), in this case the hibernate
> mapping will have a list as the association
> - as a real map (so with a map tag in the hbm).
>
> If you set the option PersistenceOptions.EMAP_AS_TRUE_MAP to false
> (default is true) then Teneo will map your emap as a list.
>
> Attached you can find an example of an emap from the Teneo testcases.
>
> Can you post your ecore and the resulting hbm?
>
> gr. Martin
>
> Luzi Anderegg wrote:
>> I modelled a map in my ecore according to
>> http://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF .3F. If I
>> use this map in my program, a MappingException arises? Is there
>> anything special with maps and teneo? Do I have to annotate my ecore?
>>
>> Regards,
>> Luzi
>
>
Re: [Teneo] How to model a map? [message #423064 is a reply to message #423061] Mon, 22 September 2008 14:58 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Luzi,
For my info, can you also post the relevant part of the mapping? And the stack trace of the
mappingexception?

gr. Martin

Luzi Anderegg wrote:
> Unfortunately, I'm not allowed to post the whole ecore. Below you find
> the parts containing the map:
>
> <eClassifiers xsi:type="ecore:EClass" name="IntegerToToolPinMapEntry"
> instanceClassName="java.util.Map$Entry">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="key"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="value"
> eType="#//ToolPin"
> containment="true"/>
> </eClassifiers>
>
> and the referencing class:
>
> <eClassifiers xsi:type="ecore:EClass" name="ToolElement">
> <eStructuralFeatures xsi:type="ecore:EReference" name="inputPins"
> upperBound="-1"
> eType="#//IntegerToToolPinMapEntry" containment="true"/>
> </eClassifiers>
>
> Luzi
>
> Martin Taal wrote:
>> Hi Luzi,
>> Yes maps should work. There are two ways in which Teneo can map maps:
>> - as a list of map entries (key, value pair), in this case the
>> hibernate mapping will have a list as the association
>> - as a real map (so with a map tag in the hbm).
>>
>> If you set the option PersistenceOptions.EMAP_AS_TRUE_MAP to false
>> (default is true) then Teneo will map your emap as a list.
>>
>> Attached you can find an example of an emap from the Teneo testcases.
>>
>> Can you post your ecore and the resulting hbm?
>>
>> gr. Martin
>>
>> Luzi Anderegg wrote:
>>> I modelled a map in my ecore according to
>>> http://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF .3F. If I
>>> use this map in my program, a MappingException arises? Is there
>>> anything special with maps and teneo? Do I have to annotate my ecore?
>>>
>>> Regards,
>>> Luzi
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] How to model a map? [message #423070 is a reply to message #423064] Mon, 22 September 2008 15:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: luzi.anderegg.ergon.ch

Hi Martin,

here is the relevant part of the mapping (I hope):

<class name="xxxxxxxxxxxxxxxxxx.impl.ToolElementImpl"
entity-name="ToolElement" abstract="false" lazy="false"
discriminator-value="ToolElement" table="`toolelement`">
<meta attribute="eclassName">ToolElement</meta>
<meta attribute="epackage">http:///xxxxxxxxxxxxxx.ecore</meta>
<map name="inputPins" lazy="true" cascade="all,delete-orphan">
<key update="true" foreign-key="toolelement_inputpins">
<column name="`toolelement_inputpins_e_id`" not-null="false"
unique="false"/>
</key>
<map-key type="java.lang.Integer"/>
<one-to-many entity-name="ToolPin"/>
</map>
</class>

Gr.
Luzi

Martin Taal wrote:
> Hi Luzi,
> For my info, can you also post the relevant part of the mapping? And the
> stack trace of the mappingexception?
>
> gr. Martin
>
> Luzi Anderegg wrote:
>> Unfortunately, I'm not allowed to post the whole ecore. Below you find
>> the parts containing the map:
>>
>> <eClassifiers xsi:type="ecore:EClass" name="IntegerToToolPinMapEntry"
>> instanceClassName="java.util.Map$Entry">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="key"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="value"
>> eType="#//ToolPin"
>> containment="true"/>
>> </eClassifiers>
>>
>> and the referencing class:
>>
>> <eClassifiers xsi:type="ecore:EClass" name="ToolElement">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="inputPins"
>> upperBound="-1"
>> eType="#//IntegerToToolPinMapEntry" containment="true"/>
>> </eClassifiers>
>>
>> Luzi
>>
>> Martin Taal wrote:
>>> Hi Luzi,
>>> Yes maps should work. There are two ways in which Teneo can map maps:
>>> - as a list of map entries (key, value pair), in this case the
>>> hibernate mapping will have a list as the association
>>> - as a real map (so with a map tag in the hbm).
>>>
>>> If you set the option PersistenceOptions.EMAP_AS_TRUE_MAP to false
>>> (default is true) then Teneo will map your emap as a list.
>>>
>>> Attached you can find an example of an emap from the Teneo testcases.
>>>
>>> Can you post your ecore and the resulting hbm?
>>>
>>> gr. Martin
>>>
>>> Luzi Anderegg wrote:
>>>> I modelled a map in my ecore according to
>>>> http://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF .3F. If
>>>> I use this map in my program, a MappingException arises? Is there
>>>> anything special with maps and teneo? Do I have to annotate my ecore?
>>>>
>>>> Regards,
>>>> Luzi
>>>
>>>
>
>
Re: [Teneo] How to model a map? [message #423073 is a reply to message #423070] Mon, 22 September 2008 15:14 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Luzi,
And can you post the mappingexception?

gr. Martin

Luzi Anderegg wrote:
> Hi Martin,
>
> here is the relevant part of the mapping (I hope):
>
> <class name="xxxxxxxxxxxxxxxxxx.impl.ToolElementImpl"
> entity-name="ToolElement" abstract="false" lazy="false"
> discriminator-value="ToolElement" table="`toolelement`">
> <meta attribute="eclassName">ToolElement</meta>
> <meta attribute="epackage">http:///xxxxxxxxxxxxxx.ecore</meta>
> <map name="inputPins" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="toolelement_inputpins">
> <column name="`toolelement_inputpins_e_id`"
> not-null="false" unique="false"/>
> </key>
> <map-key type="java.lang.Integer"/>
> <one-to-many entity-name="ToolPin"/>
> </map>
> </class>
>
> Gr.
> Luzi
>
> Martin Taal wrote:
>> Hi Luzi,
>> For my info, can you also post the relevant part of the mapping? And
>> the stack trace of the mappingexception?
>>
>> gr. Martin
>>
>> Luzi Anderegg wrote:
>>> Unfortunately, I'm not allowed to post the whole ecore. Below you
>>> find the parts containing the map:
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="IntegerToToolPinMapEntry"
>>> instanceClassName="java.util.Map$Entry">
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="key"
>>> eType="ecore:EDataType
>>> http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="value"
>>> eType="#//ToolPin"
>>> containment="true"/>
>>> </eClassifiers>
>>>
>>> and the referencing class:
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="ToolElement">
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="inputPins"
>>> upperBound="-1"
>>> eType="#//IntegerToToolPinMapEntry" containment="true"/>
>>> </eClassifiers>
>>>
>>> Luzi
>>>
>>> Martin Taal wrote:
>>>> Hi Luzi,
>>>> Yes maps should work. There are two ways in which Teneo can map maps:
>>>> - as a list of map entries (key, value pair), in this case the
>>>> hibernate mapping will have a list as the association
>>>> - as a real map (so with a map tag in the hbm).
>>>>
>>>> If you set the option PersistenceOptions.EMAP_AS_TRUE_MAP to false
>>>> (default is true) then Teneo will map your emap as a list.
>>>>
>>>> Attached you can find an example of an emap from the Teneo testcases.
>>>>
>>>> Can you post your ecore and the resulting hbm?
>>>>
>>>> gr. Martin
>>>>
>>>> Luzi Anderegg wrote:
>>>>> I modelled a map in my ecore according to
>>>>> http://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF .3F. If
>>>>> I use this map in my program, a MappingException arises? Is there
>>>>> anything special with maps and teneo? Do I have to annotate my ecore?
>>>>>
>>>>> Regards,
>>>>> Luzi
>>>>
>>>>
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:CDO make table DB bug
Next Topic:Re: Does a datatype describing the name of a EStructuralFeature exist?
Goto Forum:
  


Current Time: Fri Jan 24 05:12:13 GMT 2020

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

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

Back to the top