You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Joe Pullen (JIRA)" <ji...@apache.org> on 2009/09/26 13:55:16 UTC

[jira] Commented: (OPENJPA-466) Primary key constraint violated using (Oracle) sequence to generate ID in multithreaded app

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

Joe Pullen commented on OPENJPA-466:
------------------------------------

Today came back to this issue get the patch and was surprised that after the first fix there was more discussion. Just wanted to say from my view the original patch from Tim did the job perfectly.

As Tim stated I can tell you that the original patch was def needed and helped solve a major issue with an application running on 4 T2000 Solaris machines (each with 64 cores, yes 256 cores !). This J2EE app has processed 10 millions of business transactions with throughput in peak of 100,000s business transactions (equals to 250,000 JTA and over a million SQL statements) per hour without a SINGLE duplicate primary key error related to sequences.


> 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: Milosz Tylenda
>            Priority: Blocker
>             Fix For: 1.0.4, 1.2.2, 1.3.0, 2.0.0-M3
>
>         Attachments: OPENJPA-466-1.0.x.patch, OPENJPA-466-1.2.x.patch, OPENJPA-466-SYNCRONIZED.patch, OPENJPA-466.patch, OPENJPA-466.patch, volatile.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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.