[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6486?page=c...
]
Sebastian Jancke commented on HHH-6486:
---------------------------------------
We are seeing this problem also, seems like Hi/Lo-Sequence-Generator is broken, if
allocationSize is greater than 1. This make the use of sequences pretty useless and slow,
if the appserver cannot cache them.
@Andreas Beckers: What did you unterstand / Why is it your fault? It would be helpful for
others if you explained a bit more.
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:
http://www.atlassian.com/software/jira