Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [texo] [teneo]? Support for opposites
[texo] [teneo]? Support for opposites [message #1131746] |
Thu, 10 October 2013 15:32  |
Eclipse User |
|
|
|
Hi,
In my Texo implementation it doesn't appear that opposites definitions are being respected. That is, if I set book.setLibrary I would expect that I wouldn't need to do myLibrary.getBooks().add(book). However, when I persist the entities, and then retrieve them, only the value for the book.library is being set. It seem that under the covers, the while the Book library column is being set, a row is not being created in library_book for the pair.
Perhaps I have something misconfigured here..?
cheers,
Miles
|
|
| | |
Re: [texo] [teneo]? Support for opposites [message #1131949 is a reply to message #1131847] |
Thu, 10 October 2013 18:36   |
Eclipse User |
|
|
|
Hi Miles,
The default list implementation used by Texo does not check for duplicates.
For the opposite relation not working, are you setting both sides explicitly? Or are you making use of the bidirectional
api/option from Texo:
http://wiki.eclipse.org/Texo/Code_Generation_Patterns#Generation_of_a_safe_bi-directional_association_API_.28or_not.29
Can you post/link the Book/Library java files and the orm file?
gr, Martin
On 10/10/2013 11:05 PM, Miles Parker wrote:
> I made some progress on this. First, I had forgotten that the generated orm doesn't remove old annotations for existing
> classes (I think there is already a bug there) so I had both a ManyToOn and OneToMany annotation for the same reference.
> Then after fixing that, I discovered that I wasn't testing for having an object already added to list, which was causing
> the problem above. I believe that EMF does check for duplicates, but I'm not sure.
>
> So now at least I can get the behaviour I want -- however, the opposite relation still doesn't appear to be working. And
> actually, looking at the generated model code I'm not sure how it could. So perhaps this is a feature request / bug report?
--
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: [texo] [teneo]? Support for opposites [message #1142815 is a reply to message #1142642] |
Thu, 17 October 2013 17:49  |
Eclipse User |
|
|
|
Hi Miles,
Yes I see your point, the 'problem' is that Texo really tries to use only standard java list/set implementations which
do not support bidirectional behavior.
gr. Martin
On 10/17/2013 09:24 PM, Miles Parker wrote:
> Hi Martin...
>
> Martin Taal wrote on Thu, 10 October 2013 18:36
>> Hi Miles,
>> For the opposite relation not working, are you setting both sides explicitly? Or are you making use of the
>> bidirectional api/option from Texo:
>
>
> I was not making use of the bi-directional API, but just assuming that it would happen automatically. As mentioned
> above, I got it working by doing both, but I could use the API as well. So I think I'm good here. Still, would be nice
> to support this from standard list API for opposites as EMF does.
--
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
|
|
|
Goto Forum:
Current Time: Tue Jul 22 15:25:24 EDT 2025
Powered by FUDForum. Page generated in 0.05021 seconds
|