Java – JPA / Hibernate has too many increments for Oracle sequences

I use hibernate on my java project. I have Oracle dB For an ID column, I determine a sequence with an increment of 1 But this is how JPA / Hibernate gets nextval from the sequence:

1   1451
2   1450
3   1402
4   1401
5   1400
6   1352
7   1351
8   1350
9    426

You can see that nextval sometimes gets 1, but most get 50 or more I even see the beginning of sequence 200, even if I put the starting value 1 Why did this happen? Is this normal?

Can I reduce this "50" increment in some way?

Edit: duplicate hibernate Oracle sequence produces large gap

Solution

I found this solution

>I set the sequence cache to "no cache" > I put "allocationsize = 1" in the comment @ sequencegenerator of the @ ID attribute, as follows: https://stackoverflow.com/a/5346701/169534

The problem is solved

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>