Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » OneToMany from an embeddable object
OneToMany from an embeddable object [message #501863] Fri, 04 December 2009 07:33 Go to next message
Ed Hansen is currently offline Ed HansenFriend
Messages: 1
Registered: December 2009
Junior Member
I originally had the following scenario - which was working fine. Object A had a one-to-many relationship with Object B which in turn had a one-to-many relationship with Object C. The relationship between A and B was then changed to a one-to-one. The DB table for B was removed and its columns were moved to the DB table for A.

So I modified the mapping for B to be Embeddable and defined its fields in the mapping for A.

So now I have Object A with a one-to-one relationship to an Embedded Object B, which still needs to have a one-to-many relationship to Object C. This fails with the following error:
"An association from the table xxx refers to an unmapped class: yyy"

I removed Object C from the mapping, then A and B worked fine. As another test, I moved the one-to-many relationship from B to C from the mapping for B into the mapping for A (thus making A have a one-to-many relationship to C), it works fine.

Question: Is it possible to have a one-to-many relation from an Embeddable object?

Thanks for your help.
Re: OneToMany from an embeddable object [message #501897 is a reply to message #501863] Fri, 04 December 2009 11:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30653
Registered: July 2009
Senior Member
Ed,

If this is a Teneo question, would it sounds like, please in the future
prefix the subject line with [teneo] so that Martin is sure to notice it.


Ed Hansen wrote:
> I originally had the following scenario - which was working fine.
> Object A had a one-to-many relationship with Object B which in turn
> had a one-to-many relationship with Object C. The relationship
> between A and B was then changed to a one-to-one. The DB table for B
> was removed and its columns were moved to the DB table for A.
>
> So I modified the mapping for B to be Embeddable and defined its
> fields in the mapping for A.
>
> So now I have Object A with a one-to-one relationship to an Embedded
> Object B, which still needs to have a one-to-many relationship to
> Object C. This fails with the following error: "An association from
> the table xxx refers to an unmapped class: yyy"
>
> I removed Object C from the mapping, then A and B worked fine. As
> another test, I moved the one-to-many relationship from B to C from
> the mapping for B into the mapping for A (thus making A have a
> one-to-many relationship to C), it works fine.
>
> Question: Is it possible to have a one-to-many relation from an
> Embeddable object?
> Thanks for your help.
Re: OneToMany from an embeddable object [message #501944 is a reply to message #501897] Fri, 04 December 2009 14:50 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ed,
The testcases did not yet cover this case (a one-to-many in a component). So I adapted the embedded testcase to also
include one to many. I noticed several issues which I solved along the way to get my test cases to pass (the fix will be
in the next build for Teneo 1.2 within a few days).

Only the problem is...
That the issues I solved do not seem to be related to the error you are getting, it seems a completely other one.

So assuming that you are on the 1.2 version I think it is best to see if the latest build helps or shows the same error.

Btw, one thing that won't work (not supported by hibernate it seems) is a one-to-many in a component-element, so a
one-to-many in a embedded component of a one to many. For example this is not possible: A has a one-to-many to B and B
is embedded in the join table and B has a one-to-many to a C. This case however can also be mapped as a non-embedded
case (it would result in the same relational schema afaics).

gr. Martin

Ed Merks wrote:
> Ed,
>
> If this is a Teneo question, would it sounds like, please in the future
> prefix the subject line with [teneo] so that Martin is sure to notice it.
>
>
> Ed Hansen wrote:
>> I originally had the following scenario - which was working fine.
>> Object A had a one-to-many relationship with Object B which in turn
>> had a one-to-many relationship with Object C. The relationship
>> between A and B was then changed to a one-to-one. The DB table for B
>> was removed and its columns were moved to the DB table for A.
>>
>> So I modified the mapping for B to be Embeddable and defined its
>> fields in the mapping for A.
>>
>> So now I have Object A with a one-to-one relationship to an Embedded
>> Object B, which still needs to have a one-to-many relationship to
>> Object C. This fails with the following error: "An association from
>> the table xxx refers to an unmapped class: yyy"
>>
>> I removed Object C from the mapping, then A and B worked fine. As
>> another test, I moved the one-to-many relationship from B to C from
>> the mapping for B into the mapping for A (thus making A have a
>> one-to-many relationship to C), it works fine.
>>
>> Question: Is it possible to have a one-to-many relation from an
>> Embeddable object? Thanks for your help.


--

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: OneToMany from an embeddable object [message #501982 is a reply to message #501944] Fri, 04 December 2009 16:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ed,
It took less time than a few days...
The latest build (1.1.2 version) I published a minute back supports one-to-many for embedded components. Although again
I am not sure if it solves your issue which seems a bit different.

gr. Martin

Martin Taal wrote:
> Hi Ed,
> The testcases did not yet cover this case (a one-to-many in a
> component). So I adapted the embedded testcase to also include one to
> many. I noticed several issues which I solved along the way to get my
> test cases to pass (the fix will be in the next build for Teneo 1.2
> within a few days).
>
> Only the problem is...
> That the issues I solved do not seem to be related to the error you are
> getting, it seems a completely other one.
>
> So assuming that you are on the 1.2 version I think it is best to see if
> the latest build helps or shows the same error.
>
> Btw, one thing that won't work (not supported by hibernate it seems) is
> a one-to-many in a component-element, so a one-to-many in a embedded
> component of a one to many. For example this is not possible: A has a
> one-to-many to B and B is embedded in the join table and B has a
> one-to-many to a C. This case however can also be mapped as a
> non-embedded case (it would result in the same relational schema afaics).
>
> gr. Martin
>
> Ed Merks wrote:
>> Ed,
>>
>> If this is a Teneo question, would it sounds like, please in the
>> future prefix the subject line with [teneo] so that Martin is sure to
>> notice it.
>>
>>
>> Ed Hansen wrote:
>>> I originally had the following scenario - which was working fine.
>>> Object A had a one-to-many relationship with Object B which in turn
>>> had a one-to-many relationship with Object C. The relationship
>>> between A and B was then changed to a one-to-one. The DB table for B
>>> was removed and its columns were moved to the DB table for A.
>>>
>>> So I modified the mapping for B to be Embeddable and defined its
>>> fields in the mapping for A.
>>>
>>> So now I have Object A with a one-to-one relationship to an Embedded
>>> Object B, which still needs to have a one-to-many relationship to
>>> Object C. This fails with the following error: "An association from
>>> the table xxx refers to an unmapped class: yyy"
>>>
>>> I removed Object C from the mapping, then A and B worked fine. As
>>> another test, I moved the one-to-many relationship from B to C from
>>> the mapping for B into the mapping for A (thus making A have a
>>> one-to-many relationship to C), it works fine.
>>>
>>> Question: Is it possible to have a one-to-many relation from an
>>> Embeddable object? Thanks for your help.
>
>


--

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:Editor ViewerPane with tool button
Next Topic:new EMF tutorial
Goto Forum:
  


Current Time: Thu Nov 21 04:21:22 GMT 2019

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

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

Back to the top