Re: Disable constraint checking under H2
Re: Disable constraint checking under H2
- Subject: Re: Disable constraint checking under H2
- From: Chuck Hill <email@hidden>
- Date: Wed, 20 Mar 2013 17:48:48 -0700
On 2013-03-20, at 4:17 PM, Paul Hoadley wrote:
> On 21/03/2013, at 9:26 AM, Chuck Hill <email@hidden> wrote:
>
>> On 2013-03-20, at 3:08 PM, Paul Hoadley wrote:
>>
>>> On 21/03/2013, at 1:36 AM, Chuck Hill <email@hidden> wrote:
>>>
>>>> On 2013-03-20, at 3:12 AM, Paul Hoadley wrote:
>>>>
>>>>> On 20/03/2013, at 2:49 PM, Chuck Hill <email@hidden> wrote:
>>>>>
>>>>>> David Avendasora had an improved delegate that I think he mentioned committing to Wonder. Maybe he has not gotten around to it? Logically, you can't have mandatory circular relationships without deferred constraint handling.
>>>>>
>>>>> Unless I've not looked closely enough at my own model, half of the circle here is optional, which should be alright. (Shouldn't it?) Does the ERXEntityDependencyOrderingDelegate look to see whether the relationships are optional/mandatory and make allowances, or does it just get as far as seeing that there's a cycle?
>>>>
>>>> My version just stopped when it saw a cycle. I think. I have not used it in years.
>>>
>>> Yeah, it seems to. I meant "alright" in a more general sense.
>>
>> I was going to say yes, but realized the answer is No. It is only OK if the optional part is null and that row is inserted first. If it is NOT null, the database will want to verify the validity immediately and it won't be there. The only thing the database knows about the optionality is that null is allowed.
>
> Yeah. I meant "more general sense" in that it's alright to have a model with a cycle where one of the relationships is optional, not in the general sense that _any arbitrary transaction_ will be OK. Going back to the concrete example here, I've got Person.organisation (mandatory—every user is from an organisation) and Organisation.creator (optionally back to Person so that you can indicate which user created a new Organisation object). It does present a bootstrapping problem in that the first Organisation won't have a creator. Is there a better pattern for this kind of thing?
I used to drop the FK constraints on just these relationships. I don't think there is a better pattern if you are using a database a does not allow the modelling of reality. :-)
Chuck
--
Chuck Hill
Executive Managing Partner, VP Development and Technical Services
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
_______________________________________________
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