|
Re: [Texo] Modeling a OneToOne relationship [message #1250434 is a reply to message #1244027] |
Wed, 19 February 2014 08:39 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hey Ralf,
I am on holiday therefore the slower than usual answer...
Texo will generate a many-to-one if there is no opposite ereference from Contact to Document, or if this opposite
ereference has many=true.
Is that the case here?
gr. Martin
On 02/11/2014 09:22 PM, Ralf Heydenreich wrote:
> Hi all,
> I've tried to model a one-to-one relationship without success. At first,
> the business background :-)
>
> I've Document which has a Contact referenced (only one!). This should
> result to
>
>
> @Entity()
> public class Document implements Serializable {
> // some other attributes
>
> @OneToOne(cascade = { CascadeType.ALL })
> private Contact contact = null;
> }
>
>
> The model looks like following (AnnotationModel):
>
>
> <annotatedEStructuralFeatures
> xsi:type="annotationsmodel:AnnotatedEReference">
> <eReference href="MyEcore.ecore#//Document/contact"/>
> <eReferenceAnnotations
> xsi:type="modelannotations:EReferenceModelGenAnnotation" name="contact"
> getter="getContact" defaultValue="null" setter="setContact"
> validJavaMemberName="contact" useList="false"
> ownerEClassAnnotation="//@annotatedEPackages.0/@annotatedEClassifiers.11/@eClassAnnotations.0"
> generateSafeManyAccess="false"
> generateBidirectionalAssociationSupport="false"/>
> <eReferenceAnnotations
> xsi:type="ormannotations:EReferenceORMAnnotation">
> <joinColumn name="FK_CONTACT" nullable="true" table=""/>
> <oneToOne/>
> </eReferenceAnnotations>
> </annotatedEStructuralFeatures>
>
>
> Ecore:
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="contact"
> eType="#//Contact" containment="true"/>
>
>
> However, the generated has a @ManyToOne annotation for contact. How can
> I get this right?
>
> TIA,
> Ralf.
>
--
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.02576 seconds