[ 
https://issues.apache.org/jira/browse/OPENJPA-2913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18153009#comment-18153009
 ] 

Richard Zowalla commented on OPENJPA-2913:
------------------------------------------

Pull request: 
[https://github.com/apache/openjpa/pull/330|https://github.com/apache/openjpa/pull/330]



> TableJDBCSeq can generate 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
>            Assignee: Richard Zowalla
>            Priority: Major
>
> 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.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
  • [jira] [Commented] (OPENJPA... Richard Zowalla (Jira) via dev

Reply via email to