Hi Anjo,

On Jan 23, 2008, at 3:54 PM, Anjo Krank wrote:


Am 23.01.2008 um 21:06 schrieb David Elliott:

Do I think this is something that ought to go into EOF proper? Not really. But the original poster was looking for a way to automatically fix his PK sequences and so I'm giving him the outline of how he could do this. He may decide (and I would if I were him) that ultimately it's cheaper to remind yourself to update the PK sequence if you make changes outside of EOF.

He can simply add a trigger on insert. So could EOF, btw...

A trigger that updated EOF's PK table on insert of duplicate PK value would work quite well. But you still need to let the DB exception happen so that the transaction fails and gets rolled back. On the Java side add a handler for that and just reattempt the save which will work the second time since the PK's will have been updated.

Of course one minor issue.. how do you update the contents of the PK table from a transaction that must ultimately be rolled back by EOF so that it can keep a consistent view of the database? On Postgres you can sort of automatically work around this since the next value of a sequence is purposefully not affected by transactions so setting it and then rolling back the transaction will leave the next sequence value changed. But if you're using the PK table then I suppose you have to do some slightly more fancy stuff to get that to happen, but maybe EOF does that anyway?

-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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to