OPENJPA-1376: Correctly handle the case when sequence increment is > 1.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1078811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Milosz Tylenda 2011-03-07 15:30:25 +00:00
parent 1d889e3e50
commit 0022b991ab
1 changed files with 6 additions and 2 deletions

View File

@ -192,11 +192,15 @@ public class NativeJDBCSeq
protected synchronized Object nextInternal(JDBCStore store, ClassMapping mapping) protected synchronized Object nextInternal(JDBCStore store, ClassMapping mapping)
throws SQLException { throws SQLException {
if (_nextValue < _maxValue) { if (_nextValue < _maxValue) {
return _nextValue++; long result = _nextValue;
_nextValue += _increment;
return result;
} }
allocateInternal(0, store, mapping); allocateInternal(0, store, mapping);
return _nextValue++; long result = _nextValue;
_nextValue += _increment;
return result;
} }
/** /**