|
Re: [Teneo] Dynamic EMF, References [message #1051791 is a reply to message #1051461] |
Mon, 29 April 2013 08:19 |
Martin Taal Messages: 5468 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03134 seconds