This issue affects 5.0.3.Final When running a distributed application on two different JVMs, sharing the same database, constraint violation errors occur since the code in the generate method does not reset the value to the correct lower limit, given a new value of upper limit, but it only increments it. It is assumed that the number returned by callback.getNextValue() is consecutive to the one previously obtained, but that is a wrong assumption, since another thread, in another JVM or not, might have already consumed other values. The fix suggested by Tomasz Rosiek fixes the issue. |