I have legacy oracle db with a sequence named 'PRODUCT_ID_SEQ'. And here the mapping of Product class for which I need generate correct ids:
public class Product {
@GeneratedValue(strategy = GenerationType.SEQUENCE,
generator = "etailerRaw_seq")
@SequenceGenerator(name = "etailerRaw_seq",
sequenceName = "'PRODUCT_ID_SEQ")
private Long id;
...
}
But looks like ids are generated with an interval of 50, like 1000, 1050, 1100 etc. This corresponds to the default value of allocationSize property = 50. So that means that hibernate doesn't actually use the sequence which is already defined in the db.
How do I make hibernate use the sequence?