Re: Batching creation of primary keys with Oracle
Re: Batching creation of primary keys with Oracle
- Subject: Re: Batching creation of primary keys with Oracle
- From: Anjo Krank <email@hidden>
- Date: Fri, 25 Apr 2008 17:16:36 +0200
The problem is that EOF proper has no way to know your sequence has an
higher increment... a general solution would be to make a method that
would loop over a model, check for some key (ERXPrimaryKeyBatchSize
would be recommended) and exec alter the sequence to that increment.
Then you can use the same info in your DBC delegate or Oracle plugin
subclass and create a cache for PKs (which you fetch manually). A
sample implementation is in ERXJDBCAdaptor as of two hours ago.
Alternately, you can use the ERXLongPrimaryKeyFactory which does
pretty much the same as the default EOF implementation.
Cheers, Anjo
Am 25.04.2008 um 16:24 schrieb Ken Anderson:
Mike,
Unfortunately, I haven't messed with this stuff for a long time, so
I'm not clear on how to modify the increment on the sequence, or how
to grab them myself and hand them out. Do I need to implement the
database context delegate databaseContextNewPrimaryKey() ? If I do,
what's the right way to store the interim keys and grab them when
necessary? I've pretty much always been a 'let the adaptor handle
it' kind of guy as far as primary keys are concerned...
I've googled plenty - I can't find any roadmaps or code to help me
along.
Thanks!
Ken
On Apr 25, 2008, at 8:43 AM, Mike Schrag wrote:
BTW, I'm using WO 5.3 and Oracle 10g. And no, I'm not using
WOnder, in case anyone is going to say:
"Oh, if you're using WOnder, you just flip this little do-hickey
over here..."
In Oracle, I would recommend a hi-lo algorithm. Set your sequence
to have a 30 increment (or whatever) and hand out the 30 individual
keys from the counter in memory.
ms
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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