Why do I need to add allocSize = 1 when using @TableGenerator to ensure that id will not go from 1, 2, ... to 32, xxx, 65, xxx, ... after restarting jvm
Is there a design reason for specifying allocSize?
This snippet will create jumping identifiers
@Id @GeneratedValue(strategy = GenerationType.TABLE) private Long id;
Here's a modified snippet that creates correctly ordered identifiers
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "account_generator") @TableGenerator(name = "account_generator", initialValue = 1, allocationSize = 1) private Long id;
source share