Re: Why doesn't EOF sort our PK problems itself ?
Re: Why doesn't EOF sort our PK problems itself ?
- Subject: Re: Why doesn't EOF sort our PK problems itself ?
- From: David Elliott <email@hidden>
- Date: Wed, 23 Jan 2008 16:09:32 -0500
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden