Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Hibernate EList (Elist persisting issue )
Hibernate EList [message #924976] Thu, 27 September 2012 09:25 Go to next message
zainab alhaidary is currently offline zainab alhaidaryFriend
Messages: 20
Registered: April 2012
Junior Member
hello everybody,
I'm using Teneo/Hibernate to map my data model to a Oracle database,
within the model I have a many-to-many relation, according to this http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Association_Mapping
hibernate cannot handle nm relations therefor I have to separate them into two tables and use Elist (org.eclipse.emf.common.util.EList). Now my problem is in persisting the entities in the Elist. It seems that the mapping didn't really map the Elist. Thats why when I try to insert a value then to to get it later on it gives me null as a result.

here is a photo to explain what I mean:

Can anyone please let me know where can I refer to regarding the Elists and how to use then properly?

Thank You
  • Attachment: Untitled.png
    (Size: 267.14KB, Downloaded 44 times)
Re: Hibernate EList [message #925004 is a reply to message #924976] Thu, 27 September 2012 09:52 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Hi Zainab,
Hibernate can handle nm associations. The wiki page you refer to discusses this, it needs join tables that's all. But
this is done automatically by Teneo.

I think you create an EAttribute but you should create an EReference with upperbound -1 on both sides of the association
and as an etype use your own eclass (User) and not EEList. So it is not necessary to use EEList in your ecore file directly.

Teneo will automatically take care of creating join tables etc.

See also this page for related options:
http://wiki.eclipse.org/Teneo/Hibernate/Configuration_Options

gr. Martin

On 09/27/2012 11:25 AM, zainab alhaidary wrote:
> hello everybody,
> I'm using Teneo/Hibernate to map my data model to a Oracle database,
> within the model I have a many-to-many relation, according to this http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Association_Mapping
> hibernate cannot handle nm relations therefor I have to separate them into two tables and use Elist (org.eclipse.emf.common.util.EList). Now my problem is in persisting the entities in the Elist. It seems that the mapping didn't really map the Elist. Thats why when I try to insert a value then to to get it later on it gives me null as a result.
>
> here is a photo to explain what I mean:
>
> Can anyone please let me know where can I refer to regarding the Elists and how to use then properly?
>
> Thank You
>


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Hibernate EList [message #925022 is a reply to message #925004] Thu, 27 September 2012 10:14 Go to previous messageGo to next message
zainab alhaidary is currently offline zainab alhaidaryFriend
Messages: 20
Registered: April 2012
Junior Member
Thank You martin for your reply but I need the entity to be a list of users, not only one. So that I can associate multiple users for every container. that's why I created two join tables 1 container : n users and the other table 1 user : n containers
and users in the first table and containers in the second table are stored in Elist.

[Updated on: Thu, 27 September 2012 10:18]

Report message to a moderator

Re: Hibernate EList [message #925355 is a reply to message #925022] Thu, 27 September 2012 16:40 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Hi Zainab,
Yes but if you set the upperbound of the ereference to -1 then you will get an elist in java and you can add multiple
users. Have you checked the standard emf library example, it has a number of examples of this.

gr. Martin

On 09/27/2012 12:14 PM, zainab alhaidary wrote:
> Thank You martin for your reply but I need the entity to be a list of users, not only one. So that I can associate
> multiple users for every container.


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Hibernate EList [message #925893 is a reply to message #925355] Fri, 28 September 2012 05:45 Go to previous message
zainab alhaidary is currently offline zainab alhaidaryFriend
Messages: 20
Registered: April 2012
Junior Member
Thank You so much
Previous Topic:[XSD] Change identifier/property mapping
Next Topic:Store EMF models in a database without using Eclipse
Goto Forum:
  


Current Time: Sun Dec 21 03:26:09 GMT 2014

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

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