Hi.
I have application that runs on 2 nodes. Table uses sequence:
Code:
@SequenceGenerator(name = "GEN_ENTITY", sequenceName = "GEN_ENTITY", allocationSize = 4)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "GEN_ENTITY")
When hibernate runs out of ids he gets next value from sequence and multiplies it by allocation size, then uses that "id pool" until he runs out again.
So, for example when we have 2 nodes and nextval = 1:
let's say node_A requested nextval first
node_A_id_pool = ids from 1 to 4
node_B_id_pool = ids from 4 to 8
And now here's my question.
How long that "id pool" is stored in memory?
If my hunch is right, that they are stored in memory until application is restarted, then there is no way to ensure that ids will be used in gradually incrementing manner? And the order in same table could be:
1 2 3 5 6 4 7 8Are my assumptions correct? And is there a way to be sure that ids will be used gradually in one table when there are more than one application node?
I know that I could use allocationsize = 1, but that could impact performance if there are many objects to save...