On Sep 1, 2009, at 8:54 PM, Andrew Lindesay wrote:

Hello;

Possibly this is because Derby does not support deferred referential integrity checks.

I think Chuck wrote something which organises the adaptor operations to try and not violate the constraints from the model, but I don't know if it is infallible -- cue for Chuck to make a bold claim about his code being infallible.

Basically, what is happening is that the second object that has a FK pointing to the first object is, in fact, being inserted into the DB first. WO knows what the PK of the first object _will_ be when inserted so it has no problem telling the DB what the FK is. Since no record for the first object exists in the DB with that PK, the DB fails.

Most databases have a function to defer foreign-key constraints until the end of the transaction so you can basically say "trust me, by the time this transaction is committed, everything will be okay". If Derby doesn't have this function, then you will need to tell EOF to put all DB inserts in sequence before sending them to the database. It is possible that Derby does support this, but the plugin doesn't make use of it.

Chuck's Entity Ordering works phenomenally well, but has a couple semi- weak points when it comes to rare edge-cases. It's best to use deferred constraints if you can, or make use of the Entity Ordering. I don't have the details right now of how to get it setup. If Chuck doesn't get out of bed soon and give you the details (after a cup of coffee, of course, I'll try to get to it in a little later.

Dave


cheers.

Next exception:SQL State:23503 -- error code: 20000 -- msg: INSERT on table 'ENTRY' caused a violation of foreign key constraint 'ENTRY_USERPORTAL_FK' for key (15). The statement has been rolled back.

___
Andrew Lindesay
www.lindesay.co.nz

_______________________________________________
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/webobjects%40avendasora.com

This email sent to [email protected]



_______________________________________________
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