Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Dynamic EMF, References
[Teneo] Dynamic EMF, References [message #1051461] Sun, 28 April 2013 21:00 Go to next message
Thomas Vetsch is currently offline Thomas VetschFriend
Messages: 2
Registered: April 2013
Junior Member
Hi community,

I've done some work with the dynamic EMF approach which is explained here.

The listed example is very simple and easy to work with, but I stuck at some points and would like to ask the communitity for some help.

The following code is used to create dynamic references.

// A course always uses one SchoolBook
EReference courseBook = efactory.createEReference();
courseBook.setName("courseBook");
courseBook.setEType(schoolBookEClass);
courseBook.setContainment(false);
courseEClass.getEStructuralFeatures().add(courseBook);


With default settings, Teneo generates the mapping of the references as Many-To-One.

When i set the property "JOIN_TABLE_FOR_NON_CONTAINMENT_ASSOCIATION" to false and set the reference upperBound to "UNBOUND_MULTIPLICITY" the result is a One-to-Many reference in the mapping file.

My problem is, that i need to choose between 1:1, 1:n and n:m during the creation of these dynamic references and by now I wasn't able to get that right.

Is this even possible and what can I do to generate the desired mappings?

Please Help

Thanks in advance.

Thomas

Re: [Teneo] Dynamic EMF, References [message #1051791 is a reply to message #1051461] Mon, 29 April 2013 08:19 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5339
Registered: July 2009
Senior Member
Hi Thomas,
Setting the upperbound is the way to change something from n:1 to 1:n. The 1:1 and n:m are bi-directional associations.

Somewhat of a summary for you:
- many-to-one (example a sales order has one currency, one currency is used in many sales orders): an ereference in the
order eclass to the currency eclass, the ereference has upperbound of 1
- one-to-many (example a sales order has sales order lines): an ereference in the order eclass to the orderline eclass,
the ereference has upperbound of unbounded, as the order lines are contained in the sales order, the containment of the
ereference is true
- one-to-one (example a person has a personinfo eclass): bidirectional, 2 ereferences from person to personinfo and vice
versa, in both ereferences set the upperbound to 1, set the eopposite of both ereferences (one ereference has the other
ereference as the opposite)
- many-to-many: same setup as one-to-one, only set the upperbound for both ereferences to unbounded

gr. Martin


On 04/29/2013 04:53 AM, Thomas Vetsch wrote:
> Hi community,
>
> I've done some work with the dynamic EMF approach which is explained
> http://wiki.eclipse.org/Teneo/Hibernate/Dynamic_EMF_Tutorial.
>
> The listed example is very simple and easy to work with, but I stuck at some points and would like to ask the
> communitity for some help.
>
> The following code is used to create dynamic references.
>
> // A course always uses one SchoolBook
> EReference courseBook = efactory.createEReference();
> courseBook.setName("courseBook");
> courseBook.setEType(schoolBookEClass);
> courseBook.setContainment(false);
> courseEClass.getEStructuralFeatures().add(courseBook);
>
>
> With default settings, Teneo generates the mapping of the references as Many-To-One.
> When i set the property "JOIN_TABLE_FOR_NON_CONTAINMENT_ASSOCIATION" to false and set the reference upperBound to
> "UNBOUND_MULTIPLICITY" the result is a One-to-Many reference in the mapping file.
> My problem is, that i need to choose between 1:1, 1:n and n:m during the creation of these dynamic references and by now
> I wasn't able to get that right.
>
> Is this even possible and what can I do to generate the desired mappings?
>
> Please Help
>
> Thanks in advance.
>
> Thomas
>
>


--

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: [Teneo] Dynamic EMF, References [message #1051799 is a reply to message #1051791] Mon, 29 April 2013 08:29 Go to previous message
Thomas Vetsch is currently offline Thomas VetschFriend
Messages: 2
Registered: April 2013
Junior Member
Hi Martin

Thank you very much, that helps a lot. I've thought it could be something like that, but wasn't sure Smile

Greetings Thomas
Previous Topic:[CDO] CDOServer throws "The object is already closed [90007-168]" errors with H2-DB
Next Topic:e4mf
Goto Forum:
  


Current Time: Mon Nov 24 15:23:46 GMT 2014

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

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