On Tuesday 13 June 2006 1:19 pm, Craig L Russell wrote: > Hi, > > On Jun 13, 2006, at 11:01 AM, Craig L Russell wrote: > >>> 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. > > I withdraw this argument after re-reading the words. It is legal to > skip over some number of values as long as you remember which values > were skipped over so that you don't cycle before returning all of them. > > Craig > Yup. Thats why if on inserts where the user enters a value, if you check to see that the value is > CBV and that the row inserted ok, then you reset your CBV to that value +1. (Assuming that the increment is 1).
That will ensure that for the first cycle, you'll never throw a unique exception.... ;-) Its a neat little trick and since the sequence Object and the row entered with still be in memory, it would be a very, fast and efficient way to handle this problem in the short term. ;-) Kind of a neat trick. I imagine this is what they did when they developed the serial column and probably carried it over to their sequences. (Anyone at IBM care to comment? ;-) -G PS. The solution gets murky when you have to have multiple iterations or cycles. But that doesn't mean you can't find a solution that would still work and be efficient. > 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!