User reported this on 1.2.0, so why are we not integrating the fix in
1.2.x and 1.3.x?
-Donald
Joe Pullen (JIRA) wrote:
[ https://issues.apache.org/jira/browse/OPENJPA-466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676381#action_12676381 ]
Joe Pullen commented on OPENJPA-466:
------------------------------------
Hi Tim, thanks for the patch I can guarantee to anyone who is using OpenJPA
with a larger configuration (4 solaris machines with 24 core each) and oracle
sequences that this patch is a MUST.
After testing with the patch our problems with duplicate pk from sequences have
disappeared. Also the patch doesnt seem to have a major impact on performance.
Primary key constraint violated using (Oracle) sequence to generate ID in
multithreaded app
-------------------------------------------------------------------------------------------
Key: OPENJPA-466
URL: https://issues.apache.org/jira/browse/OPENJPA-466
Project: OpenJPA
Issue Type: Bug
Affects Versions: 1.0.0, 1.0.1, 1.1.0, 1.2.0
Environment: OpenJPA 1.0.0 (also tried 1.0.1 and 1.1.0-SNAPSHOT)
Oracle XE 10g (JDBC driver 10.2.0.3.0)
Windows XP Pro
Reporter: Frank Le
Assignee: Tim McConnell
Priority: Blocker
Fix For: 2.0.0
Attachments: OPENJPA-466.patch
Here's how I annotate the ID:
@Id
@SequenceGenerator(name = "FooSeq", sequenceName = "seq_foo",
allocationSize = 20)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "FooSeq")
private Long id;
Here's how I create the (Oracle) sequence:
CREATE SEQUENCE seq_foo START WITH 1 INCREMENT BY 1;
I get a primary key unique constraint violated in a multithreaded app i.e. it
doesn't happen in single-threaded!
You can simply reproduce this error by either create blocking queue or blocking
thread pool say size 5 to insert 10000+ object.