Unfortunately, I started a project with
@Id
@Generated(GenerationTime.INSERT)
@GeneratedValue(generator = "hibernate_sequence")
@GenericGenerator(
name = "hibernate_sequence",
strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
parameters = {
@Parameter(name = "increment_size", value = "100"),
@Parameter(name = "optimizer", value = "hilo")
})
private Integer id;
before I learnt that there are better ways. The problem is that my hi/lo algorithm generates values which have to be multiplied by 100 before they get used. So while I see a sequence value like 1107 in the database, it means something like that values 110700 to 110799 will get used for the next ID. This makes adding entities manually pretty error-prone.
So I'd like to switch the algorithm to pooled or pooled-lo. For this I need to change the stored value to maybe 110800? Losing a few ID's obviously doesn't matter, but I'm asking as I need a fool-proof way.
A side question (admittedly, opinion-based): Should I go for pooled or pooled-io?