【发布时间】:2024-04-28 07:50:02
【问题描述】:
我google了很多,发现很多人说allocationSize在https://www.logicbig.com/tutorials/java-ee-tutorial/jpa/seq-generator.html中的意思是'After 'allocationSize' is reached, the next id will be retrieved from the database sequence again'。
它所指的jpa文件。
The amount to increment by when allocating sequence numbers from the sequence
好像和sql中的'increment by'一样。
哪一个是对的?由于我在h2/jpa中测试,这个allocationSize不起作用,即使设置为20,sequence的下一个值也不会增加20。
我也对 sql 中的“缓存”感到困惑。
综上所述,以下面为例。
CREATE SEQUENCE ITEM_ID_SEQ START WITH 1 INCREMENT BY 100 cache 30;
INCREMENT BY 100、cache 30、allocationSize of jpa有什么区别。
谢谢。
【问题讨论】: