On 2015-05-17, 3:19 AM, "ocs.cz" wrote:
Chuck,
FrontBase will “return” the sequence number if the transaction is rolled back, but I am pretty sure that EOF does a commit immediately after selecting for a PK.
It is possible that somehow the commit after the PK select failed and the exception got eaten, I suppose. That seems a bit far fetched.
Hmmm.... here I might possibly see a way to prevent the problem in future: correct me please if I am wrong, but I understand permanentGlobalID causes this generation (and commit), right?
IIRC, the generation and commit are from EOF. permanentGlobalID calls into that code to get the ID.
Well then, what if I, at the moment any EO gets inserted into an EC, immediatelly called permanentGlobalID for it?
The original problem was caused, as best I can call, by FrontBase vending the same sequence number twice. Doing what you describe won’t change or avoid that underlying problem. It will just change when it happens.
Chuck
Unless I am overlooking something, it should get, commit and assign a safe PK for the EO. Later, when the EO gets saved, no PK clash would be possible.
About the only drawback I can see is that when generating lots of new EOs, there would be many unnecessary roundtrips to the DB and it would be sloow. But normally I create at worst tens (normally just a couple) of EOs inside a r/r loop, and batch imports
etc. need to be optimised separately anyway.
Might this be a solution? Or am I overlooking something of importance, as so often?
Thanks a lot,
OC
|