]
Sebastian Jancke commented on HHH-6486:
---------------------------------------
Agreed, thought the default generator for sequence is hilo. Ticket can be closed.
Negative ID created using Sequences
-----------------------------------
Key: HHH-6486
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6486
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Beta1, 4.0.0.Beta4
Environment: JBoss 7.0.0.Final with Hibernate 4.0.0.Beta4, Oracle 10 Express
Reporter: Andreas Beckers
We use seperated sequences for each table. Our IDs are annotated like this:
@SequenceGenerator(name = "PersonGen", sequenceName =
"person_id_seq")
@Id
@GeneratedValue(generator = "PersonGen")
public long getId() {
return _id;
}
The sequence is defined like this:
CREATE SEQUENCE person_id_seq START WITH 1 INCREMENT BY 1 NOCACHE;
The Problem is, that I get negative IDs in my object and the generated IDs are not
unique. I get the error
java.sql.SQLIntegrityConstraintViolationException: ORA-00001: Unique Constraint
(VESUVZPONF.PERSON_PKEY) verletzt
In the log I see:
Generated identifier: -21, using strategy:
org.hibernate.id.enhanced.SequenceStyleGenerator
The code worked in JBoss 6.0.0.Final using Hibernate 3.6.0.Final
I tried auto strategy which uses a single sequence that works fine.
There are ManyToOne and OneToMany relations with cascade all, don't know if
that's of importance.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: