Re: Models confused?
Re: Models confused?
- Subject: Re: Models confused?
- From: Chuck Hill <email@hidden>
- Date: Wed, 22 Dec 2010 11:28:22 -0800
On Dec 22, 2010, at 11:14 AM, David Avendasora wrote:
> On Dec 22, 2010, at 1:51 PM, Jesse Tayler wrote:
>
> EOF doesn't do DB operations in a predictable/consistent/deterministic way.
That is worth repeating as it is not obvious or expected for code to behave in a non-determinsitic way.
> If it worked before in MySQL with FK constraints in the DB, then it was just luck. EOF could easily just have inserted things in the right order by complete chance. I used MSSQL Server on a previous project and it took a while for me to figure out why sometimes the same transaction would fail and other times it would run just fine.
I also have had the same experience, so for once is it not just Dave being Dave. :-)
> If you have non-deferrable FK constraints in the DB you must either force EOF to do things in the right order, or remove the constraints.
>
> There is code that Chuck wrote (that others have eluded to) that will put 99% of normal DB operations in the correct order. Use it. Don't look back.
>
>> Should I opt away from constraints anyway? Model setting I should try?
>
> NO! Use constraints. Use them. USE THEM! You say that WO is the main handler of the data, but sooner or later something else is going to touch the data (could be another app, could be you running SQL commands from the console) and the database will allow you to happily have FKs that point to nothing, which EOF will also choke on (although there's a way to force it to swallow it using Wonder).
I once advocated not using FK constraints. I got better. Don't make my mistakes.
Chuck
>
> Use the Entity Ordering code of Chuck's. I believe you just add a line of code to the Application constructor to use an Entity Ordering Delegate (not sure, it's been a while, google is your friend). And only remove the FK constraints on self-referential relationships.
>
> Dave
>
>
> _______________________________________________
> 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
--
Chuck Hill Senior Consultant / VP Development
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/products/practical_webobjects
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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