Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Object to Object
[Teneo] Object to Object [message #426834] Thu, 22 January 2009 09:08 Go to next message
Mario Charest is currently offline Mario CharestFriend
Messages: 42
Registered: July 2009
Member
Hi everybody,

i couldn't find a solution for my problem on the web, so i'm posting here:

I want to use and persist a HashMap of the form Map<Object, Object> in
one of my classes as an attribute. I created the Map like proposed here:
http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_create_a_ Map_in_EMF.3F
and everything works fine, except of the generated Mapping file.

Instead of something like this:

<map name="testMap" table="TESTMAP" lazy="true"
cascade="all,delete-orphan">
<key update="true" foreign-key="componentdistribution_testmap">
<column name="`componentdistribution_testmap_e_id`" not-null="false"
unique="false"/>
</key>
<map-key-many-to-many entity-name="ComponentImplementation"/>
<many-to-many entity-name="DeviceClass"/>
</map>

Teneo generates this:

<map name="testMap" lazy="true" cascade="all,delete-orphan">
<key update="true" foreign-key="componentdistribution_testmap">
<column name="`componentdistribution_testmap_e_id`" not-null="false"
unique="false"/>
</key>
<map-key-many-to-many entity-name="ComponentImplementation"/>
<one-to-many entity-name="DeviceClass"/>
</map>

,giving me an extry column in the DeviceClass table instead of an extra
table. Are there any options i have to set to force an mapping like this
on top?

Thanks for any comment,

Mario
Re: [Teneo] Object to Object [message #426835 is a reply to message #426834] Thu, 22 January 2009 10:03 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Mario,
As a default for non-contaimnent relations a join table should be generated.
You can also force a jointable by adding the @JoinTable(name="TESTMAP") annotation to the model. See
here on how to do that:
http://www.elver.org/hibernate/ejb3_format.html

gr. Martin

Mario wrote:
> Hi everybody,
>
> i couldn't find a solution for my problem on the web, so i'm posting here:
>
> I want to use and persist a HashMap of the form Map<Object, Object> in
> one of my classes as an attribute. I created the Map like proposed here:
> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_create_a_ Map_in_EMF.3F
> and everything works fine, except of the generated Mapping file.
>
> Instead of something like this:
>
> <map name="testMap" table="TESTMAP" lazy="true"
> cascade="all,delete-orphan">
> <key update="true" foreign-key="componentdistribution_testmap">
> <column name="`componentdistribution_testmap_e_id`" not-null="false"
> unique="false"/>
> </key>
> <map-key-many-to-many entity-name="ComponentImplementation"/>
> <many-to-many entity-name="DeviceClass"/>
> </map>
>
> Teneo generates this:
>
> <map name="testMap" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="componentdistribution_testmap">
> <column name="`componentdistribution_testmap_e_id`" not-null="false"
> unique="false"/>
> </key>
> <map-key-many-to-many entity-name="ComponentImplementation"/>
> <one-to-many entity-name="DeviceClass"/>
> </map>
>
> ,giving me an extry column in the DeviceClass table instead of an extra
> table. Are there any options i have to set to force an mapping like this
> on top?
>
> Thanks for any comment,
>
> Mario


--

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] Object to Object [message #426860 is a reply to message #426835] Thu, 22 January 2009 18:08 Go to previous message
Mario Charest is currently offline Mario CharestFriend
Messages: 42
Registered: July 2009
Member
Thanks, the @JoinTable Annotation did it..seems as i have to read more
about EJB :>

Martin Taal schrieb:
> Hi Mario,
> As a default for non-contaimnent relations a join table should be
> generated.
> You can also force a jointable by adding the @JoinTable(name="TESTMAP")
> annotation to the model. See here on how to do that:
> http://www.elver.org/hibernate/ejb3_format.html
>
> gr. Martin
>
> Mario wrote:
>> Hi everybody,
>>
>> i couldn't find a solution for my problem on the web, so i'm posting
>> here:
>>
>> I want to use and persist a HashMap of the form Map<Object, Object> in
>> one of my classes as an attribute. I created the Map like proposed
>> here:
>> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_create_a_ Map_in_EMF.3F
>> and everything works fine, except of the generated Mapping file.
>>
>> Instead of something like this:
>>
>> <map name="testMap" table="TESTMAP" lazy="true"
>> cascade="all,delete-orphan">
>> <key update="true" foreign-key="componentdistribution_testmap">
>> <column name="`componentdistribution_testmap_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <map-key-many-to-many entity-name="ComponentImplementation"/>
>> <many-to-many entity-name="DeviceClass"/>
>> </map>
>>
>> Teneo generates this:
>>
>> <map name="testMap" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="componentdistribution_testmap">
>> <column name="`componentdistribution_testmap_e_id`" not-null="false"
>> unique="false"/>
>> </key>
>> <map-key-many-to-many entity-name="ComponentImplementation"/>
>> <one-to-many entity-name="DeviceClass"/>
>> </map>
>>
>> ,giving me an extry column in the DeviceClass table instead of an
>> extra table. Are there any options i have to set to force an mapping
>> like this on top?
>>
>> Thanks for any comment,
>>
>> Mario
>
>
Previous Topic:Problem with generating Switch class with latest EMF build
Next Topic:Strange EMF Behavior
Goto Forum:
  


Current Time: Thu Apr 25 15:04:52 GMT 2024

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

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

Back to the top