|
|
Re: [Teneo] How to model a map? [message #423061 is a reply to message #423054] |
Mon, 22 September 2008 14:36 |
Eclipse User |
|
|
|
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 |
Martin Taal 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 |
Eclipse User |
|
|
|
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 |
Martin Taal 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
|
|
|
Powered by
FUDForum. Page generated in 0.03395 seconds