Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » modelling associations
modelling associations [message #133529] Mon, 23 February 2009 21:27 Go to next message
Rachna Bakhru is currently offline Rachna BakhruFriend
Messages: 45
Registered: July 2009
Member
Hello

I am new to Teneo and Emf.
The modeling associations article on the elever website did give me some
overview. (http://www.elver.org/hibernate/hibernate_relations.html) But Is
there a more detailed article available anywhere?

I am working with the library example
I am trying to map the Writer to books relationshp as OneToMany
relationship.
<eStructuralFeatures xsi:type="ecore:EReference" name="books"
upperBound="-1"

eType="#//Book" eOpposite="#//Book/author">

<eAnnotations source="teneo.jpa">

<details key="appinfo" value="@OneToMany(mappedBy=&quot;author&quot;,
indexed=false)"/>

</eAnnotations>

</eStructuralFeatures>

But the mapping generated is always of type many-to-many.

What am I doing wrong?

Thanks
RJ







Re: modelling associations [message #133555 is a reply to message #133529] Mon, 23 February 2009 22:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi RJ,
There is no more detailed article available then what is available on elver.org or the hibernate manual (or posts on the
newsgroup).

In this case there is a many-to-many present in the mapping, but it has the special attribute unique="true", which means
it is in fact a one-to-many. A OneToMany annotation can still be mapped with a many-to-many in hbm (as long as it has
unique="true"). See these parts of the hibernate manual:
http://www.hibernate.org/hib_docs/reference/en/html/assoc-un idirectional-join.html
http://www.hibernate.org/hib_docs/reference/en/html/assoc-bi directional-join.html

Note that support for Teneo is given on the EMF newsgroup which I cc-ed.

gr. Martin

RJDAG wrote:
> Hello
>
> I am new to Teneo and Emf.
> The modeling associations article on the elever website did give me some
> overview. (http://www.elver.org/hibernate/hibernate_relations.html) But Is
> there a more detailed article available anywhere?
>
> I am working with the library example
> I am trying to map the Writer to books relationshp as OneToMany
> relationship.
> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
> upperBound="-1"
>
> eType="#//Book" eOpposite="#//Book/author">
>
> <eAnnotations source="teneo.jpa">
>
> <details key="appinfo" value="@OneToMany(mappedBy=&quot;author&quot;,
> indexed=false)"/>
>
> </eAnnotations>
>
> </eStructuralFeatures>
>
> But the mapping generated is always of type many-to-many.
>
> What am I doing wrong?
>
> Thanks
> RJ
>
>
>
>
>
>


--

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: modelling associations [message #620683 is a reply to message #133529] Mon, 23 February 2009 22:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi RJ,
There is no more detailed article available then what is available on elver.org or the hibernate manual (or posts on the
newsgroup).

In this case there is a many-to-many present in the mapping, but it has the special attribute unique="true", which means
it is in fact a one-to-many. A OneToMany annotation can still be mapped with a many-to-many in hbm (as long as it has
unique="true"). See these parts of the hibernate manual:
http://www.hibernate.org/hib_docs/reference/en/html/assoc-un idirectional-join.html
http://www.hibernate.org/hib_docs/reference/en/html/assoc-bi directional-join.html

Note that support for Teneo is given on the EMF newsgroup which I cc-ed.

gr. Martin

RJDAG wrote:
> Hello
>
> I am new to Teneo and Emf.
> The modeling associations article on the elever website did give me some
> overview. (http://www.elver.org/hibernate/hibernate_relations.html) But Is
> there a more detailed article available anywhere?
>
> I am working with the library example
> I am trying to map the Writer to books relationshp as OneToMany
> relationship.
> <eStructuralFeatures xsi:type="ecore:EReference" name="books"
> upperBound="-1"
>
> eType="#//Book" eOpposite="#//Book/author">
>
> <eAnnotations source="teneo.jpa">
>
> <details key="appinfo" value="@OneToMany(mappedBy=&quot;author&quot;,
> indexed=false)"/>
>
> </eAnnotations>
>
> </eStructuralFeatures>
>
> But the mapping generated is always of type many-to-many.
>
> What am I doing wrong?
>
> Thanks
> RJ
>
>
>
>
>
>


--

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
Previous Topic:modelling associations
Next Topic:ECORE 2 XML Schema and back
Goto Forum:
  


Current Time: Fri Apr 26 07:16:28 GMT 2024

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

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

Back to the top