Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 370716

Summary: [Texo] No solution to move the 'mapped-by' attribute from the default side of a one-to-one to the other side
Product: [Modeling] EMFT Reporter: Benoit Cantin <cantinbe>
Component: TexoAssignee: Martin Taal <mtaal>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cantinbe
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
First use case
none
Second use case none

Description Benoit Cantin CLA 2012-02-06 08:31:40 EST
Build Identifier: 

When 2 one-to-one relations are set as opposite, Texo generates a 'mapped-by' attribute on one side of this bi-directional relation. But the user can't control which side declares the attribute 'mapped-by', even through the use of the annotation model.

I suggest 2 things :
- first, if the user declares a one-to-one ORM annotation in the annotation model, and if he lets the 'mapped by' property blank, then Texo should not generate the 'mapped-by' attribute (Texo should consider that the user wants not to generate the 'mapped-by' attribute).
- second, if one side of the bi-directional relation declares a composition, then the 'mapped-by' attribute should be - by default -generated on the side not declaring this composition.

Cf. attached use cases :
- UseCase3-1.zip : the annotation model does not declare ERelations with ORM annotation One to one. 'mapped-by' is generated in Class1 while Class1 instances are compound of Class2 instances. I would have put 'mapped-by' in Class2.

- UseCase3-2.zip : now I have annotated my 2 ERelations in the annotation model. In Class1, I let the 'mapped by' property blank, with the idea that Texo will not generate this attribute. In Class2, I specify the value 'toClass2' in the 'mapped-by' property. I get a 'mapped-by' attribute in both classes which prevent me from customizing the side on which the 'mapped-by' attribute is generated.

Reproducible: Always
Comment 1 Benoit Cantin CLA 2012-02-06 08:32:23 EST
Created attachment 210576 [details]
First use case
Comment 2 Benoit Cantin CLA 2012-02-06 08:32:45 EST
Created attachment 210577 [details]
Second use case
Comment 3 Benoit Cantin CLA 2012-02-06 08:36:08 EST
My Texo version is 0.1.0.v201201301114.
Comment 4 Martin Taal CLA 2012-02-13 04:29:44 EST
Available in latest published build