Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.1.2
-
None
-
None
Description
When using the allocate() method of the ID generator of an entity using table based generation (TableJDBCSeq), the generator will start from 1 no matter what is the current value of the sequence, if it's the first allocation. If a new allocation takes place, the generator is likely to use values already allocated to other entities.
Example:
OpenJPAEntityManager oem = (OpenJPAEntityManager) em;
Generator idGenerator = oem.getIdGenerator(User.class);
idGenerator.allocate(1000);
This is because TableJDBCSeq does not update the current sequence value during allocate() calls, but only during next() calls. However, the allocate() method is exposed via the Generator interface to request preallocation for efficiency.