openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From frankca <fran...@gmail.com>
Subject Re: Unique constraint violated using Oracle sequence to generate ID only when multi-threaded.
Date Thu, 13 Dec 2007 02:41:39 GMT

FYI: I opened the issue# OPENJPA-466



frankca wrote:
> 
> Hi,
> 
> First, I understand the following is thread-safe which I mean OpenJPA
> always asks the database sequence for the next value:
>     @Id
>     @SequenceGenerator(name = "FooSeq", sequenceName = "seq_foo")
>     @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;
> 
> However, I get a primary key unique constraint violated, and this relates
> to multi-threaded i.e. it doesn't happen in single-threaded! 
> 
> Can someone please shed some lights on what are the possible scenarios
> this could happen or any solutions? 
> 
> (I'll play with openjpa.Multithreaded=true and Oracle sequence properties
> like cycle|cache|order.)
> 
> OpenJPA 1.0.0
> Oracle 10g XE
> 
> Thanks very much in advance,
> Frank
> 
> 

-- 
View this message in context: http://www.nabble.com/Unique-constraint-violated-using-Oracle-sequence-to-generate-ID-only-when-multi-threaded.-tp14199665p14308841.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message