Hi Bernd,

Längerich wrote:
Hi,

I have some problems with OJB (PB-API) and the sequence manager. I
derived a new sequence manager from the shipped HighLowImpl, that
checks for every grab size with
SequenceManagerHelper.getMaxForExtent() for the max id of the field.
This works fine with data added externally, but I have a situation
where the original HighLowImpl and my version fails:

Given the scenario, where the application has created an instance of
the sequence manager for the PK field and inserts some data with
fixed field contents from another source, with a pk field contents of
any value in the current range of prefetched ids (grabsize), I get a
dup key constraints error when the sequence manager reaches these
rows.

The background is, that we store each row to a primary data base and
a backup data base. Whenever the computer with the primary data base
crashes, it can be restored from an automatic backup, but this will
be up to several hours old, so we recover the missing data from the
backup data base and store them to the primary db (using OJB PB-Api).


Is there any way of forcing the sequence manager to be recreated? At
the moment I have a workaround with fetching grabSize ids with Identity oid = broker.serviceIdentity().buildIdentity(Object
newPersistentObject);

Is it sufficient/possible to overwrite the afterStore() method of the
sequence manager?

Yep it's possible. Assume you want to lookup the HLSequence-object for the current used (fixed) field and invalidate the current used PK value or declare that the next sequence value has to greater than this to avoid duplicate PK values. Think this should work (except if an concurrent thread request the next value before the current thread can invalidate it).

regards,
Armin


Best regards Bernd


---------------------------------------------------------------------
 To unsubscribe, e-mail: [EMAIL PROTECTED] For
additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to