Why would an entity's sequence based ID differ from the database current sequence value in EAP 6?
Issue
-
An entity class identifier is declared as follows
... @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="EVENT_SEQ_GEN") @SequenceGenerator(name="EVENT_SEQ_GEN", sequenceName="EVENT_SEQ") ...- At the time an instance of the entity class is created, the value of an Oracle sequence (
EVENT_SEQ) in the database is 55 - During insert of the instance, the ID value automatically populated is different from the sequence value (e.g. 51 or 2753)
- At the time an instance of the entity class is created, the value of an Oracle sequence (
- How does the
SEQUENCEgeneration strategy work? - What is the impact of the
hibernate.id.new_generator_mappingsproperty?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP) 6
- Hibernate 4
- Oracle
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.