Negative sequence with positive increment not supported with Hibernate in JBoss EAP
Issue
- A sequence was defined using
CREATE SEQUENCE EMPLOYEE_SEQ START WITH -100 -
A Hibernate entity using this sequence is defined with the following:
@Id @SequenceGenerator(name = "ID_GENERATOR", sequenceName = "EMPLOYEE_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID_GENERATOR") private long id; - When an instance of the entity is created, the assigned id value is
0rather than the next sequence value (if the next sequence value is < 0).
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6
- 7
- Hibernate
- 4
- 5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.