I am migrating to hibernate 5 from 3. I am seeing the sequence generator not working properly in Hibernate 5. I have sequence defined with minimum value 1000 and increment by 1. But when I am trying to create a new entity record, I am seeing a record inserted with id 951. It seems like the id was minuses 50 from actual sequence next value. In my case the ID should be 1000.
Please let me know any help.
Here is my entity and sequence:
Entity:
@Entity
@Table(name = "SOME TABLE")
public class Group {
@Id
@Column(name = "id")
@SequenceGenerator(name = "name", sequenceName ="SEQ_name" )
@GeneratedValue(strategy = GenerationType.AUTO, generator="name")
private Long id;
@Pattern(regexp = "^[^\\*]*$", message = "{3011}")
@Size(message = "{3014}")
@NotBlank(message = "{3000}")
@Column(name = NAME, unique = true, nullable = false)
private String name;
Sequence:
CREATE SEQUENCE SEQ_name MINVALUE 1000 NOMAXVALUE INCREMENT BY 1 CACHE 20 NOORDER NOCYCLE;