Hi Mikey,

On Jun 12, 2006, at 10:05 PM, [EMAIL PROTECTED] wrote:

[mjs]
I believe the problem is in how you're interpreting clause 3):
"
3) If there exists a non-negative integer N such that SMIN <= CBV + N * INC <= SMAX and the value (CBV + N * INC) has not already been
         returned in the current cycle, then let V1 be (CBV + N *
         INC). Otherwise, ...
"
-=-

It doesn't say what N is. That is to say...
Suppose you have a sequence 0,1,2,3,4 inserted so that the next number
should be 5. Yet suppose someone inserts a row with 5. Thus when you try to use 5, you generate an error. In sub-section 3), N could =6 or any number >6
but less than the MAX value of an integer.

It can be interpreted that the sequence should attempt to generate N such
that it doesn't fail on the insert....

This is where the idea of selecting the MAX() value in the identity column
and incrementing it by one for the failed insert.

And that would be a compliant solution.

As I read this part of the specification, it refers to the generation of the sequence number, and not to the usage. The trick phrase is "the value (CBV + N * INC) has not already been returned in the current cycle". As I understand "returned" it means returned by the sequence generator, and nothing to do with the usage as a column value.

In fact, you could argue that if the implementation skipped returning a sequence value just because that value had been inserted by the user into a column, it would be a bug.

Regards,

Craig

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to