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 protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to [email protected]

-- 
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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to