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 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.-tf4958206.html#a14199665
Sent from the OpenJPA Users mailing list archive at Nabble.com.