Re: EOF inserts PK automatically
Re: EOF inserts PK automatically
- Subject: Re: EOF inserts PK automatically
- From: Anjo Krank <email@hidden>
- Date: Mon, 22 Nov 2004 12:48:38 +0100
Am 22.11.2004 um 11:36 schrieb Sako!:
remember the DB see an insert as an atomic unit. All or nothing.
EOF works like this.
1. read last PK from EO_PK_Table ex. 30
2. increase col in EO_PK_Table. ex. 31
3. Finish for DB. for now.
4. EOF tries to insert a row with pk.
5. DB
a. insertes row
b. updates col in EO_PK_Table. with the SAME PK. ex. 31.
6. is 5 Atomic Unit successful? Finish for DB. else Error.
over.
Probably. But when you switch 4 and 5, meaning a second process
successfully inserts (which doesn't care about the EO_PK_TABLE and just
triggers an increment to it) before EOF is finished, then you're stuck
- which is just what I wrote. Of course your trigger on the table will
update the EO_PK_TABLE, but it's simply too late. You will have EOF
trying to insert a object with a PK that is already in the DB and I for
one don't see a good way to recover from there. You can't refault it
and the only thing you have left is to start over again. Probably.
Again: I may be wrong in that EOF uses a second/prior transaction for
getting the PK, but I pretty much doubt it. I just don't see a way
where getting these numbers can be reasonably rolled back...
Cheers, Anjo
_______________________________________________
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