我进行了大量的谷歌搜索,并发现许多人说
谢谢。
allocationSize
在https://www.logicbig.com/tutorials/java-ee-tutorial/jpa/seq-generator.html中的含义是'在达到' allocationSize '之后,下一个id将再次从数据库序列中检索
'。
而在JPA文档中它的意思是:
The amount to increment by when allocating sequence numbers from the sequence
看起来它与sql中的“increment by”相同。
哪一个是正确的?因为我在h2 / jpa中测试过,这个allocationSize不起作用,即使将其设置为20,序列的下一个值也不会增加20。
我也对sql中的“cache”感到困惑。
总之,以以下示例为例。
CREATE SEQUENCE ITEM_ID_SEQ START WITH 1 INCREMENT BY 100 cache 30;
INCREMENT BY 100, cache 30, 和 jpa的allocationSize有什么区别?谢谢。