Re: one-to-many relationship question
Re: one-to-many relationship question
- Subject: Re: one-to-many relationship question
- From: Michael Gargano <email@hidden>
- Date: Thu, 08 Sep 2011 15:18:50 -0700
- Acceptlanguage: en-US
- Thread-topic: one-to-many relationship question
Hi Ramsey,
Thanks! It was the deferred assignment. I had added those FKs myself (aka not using migration), I didn't realize that deferment was how assignment order was being guaranteed (or not guaranteed for that matter).
Thanks again.
-Mike
On Sep 8, 2011, at 4:18 PM, Ramsey Gurley wrote:
> Hi Mike,
>
> That's a different question/answer entirely (^_^)
>
> You need to order your adaptor operations if your database can not do deferred foreign key constraints. You can do order your ops with a property:
>
> com.webobjects.eoaccess.ERXEntityDependencyOrderingDelegate.active=true
>
> Keep in mind this cannot solve unsolvable problems like required circular relationships. To fix that requires a new choice in databases.
>
> For information regarding your model, I find the most complete resource is still Apple's old EOModeler docs.
>
> http://developer.apple.com/legacy/mac/library/#documentation/WebObjects/UsingEOModeler/Introduction/Introduction.html
>
> It's worth pointing out that if you did model this as horizontal instead of single table, you'd have FK constraint problems of a different sort. More info in the "gotchas" under the description of HI here:
>
> http://wiki.objectstyle.org/confluence/display/WO/Modeling+Inheritance+with+Entity+Modeler
>
> Ramsey
>
> On Sep 8, 2011, at 12:58 PM, Michael Gargano wrote:
>
>> Don't worry you're not losing me. :) Basically, this is what's happening....
>>
>> I have entity A1 with single table inheritance children A2 and A3
>>
>> A1 has <->> B1, which is also passed on to the children
>>
>> I'm creating a new A3 instance and a bunch of new B1 instances, I add the B1's to the A3 relationship
>>
>> I go to commit A3 and it tries to commit the B1's first, which explodes because of the FK constraint to A3.
>>
>> This isn't happening anywhere else so I'm not sure what's wrong (I'm hoping it's not just luck), but basically I'm asking if A1,A2,A3 "own" B1 is that the indication to EOF that B1 needs to be committed second, after a PK has been generated and committed on A3
>>
>> Thanks.
>> -Mike
>>
>>
>>
>> On Sep 8, 2011, at 3:40 PM, Philippe Rabier wrote:
>>
>>> Michael, there are 2 distinct notions.
>>>
>>> Cascading delete is clear enough I guess.
>>>
>>> When an object A "owns" an object B, that means that B can't live
>>> without A. The consequence is when you remove the relationship between
>>> A and B, B will be deleted automatically (think about invoice and
>>> invoice items).
>>>
>>> Sorry, I don't understand the second question. Basically, when you
>>> create A, you must create B and link B to A as usual.
>>>
>>> I don't want to lose you but there is another case: if you have a to-
>>> one between Entity A and Entity B, if EA "owns" EB and you check
>>> "propagate primary key", object B will be automatically created when
>>> you create object A. That's not your question but just in caseā¦
>>>
>>> Bests,
>>>
>>> Philippe
>>>
>>> On 8 sept. 11, at 20:59, Michael Gargano wrote:
>>>
>>>> Hi all,
>>>>
>>>> Quick question, does delete on cascade imply owns destination?
>>>> Also, does checking owns destination force the insertion of the
>>>> destination objects after the insertion of the source entity?
>>>>
>>>> I think David LeBer answered this for me once, but I forgot.
>>>>
>>>> Thanks.
>>>> -Mike
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>>
>>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden