Dario Napolitano created OPENJPA-2913:
-----------------------------------------
Summary: TableJDBCSeq can genarate duplicate IDs if allocate() is
called
Key: OPENJPA-2913
URL: https://issues.apache.org/jira/browse/OPENJPA-2913
Project: OpenJPA
Issue Type: Bug
Components: kernel
Affects Versions: 3.1.2
Reporter: Dario Napolitano
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 the 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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)