I am running into this really weird issue where an oracle sequence returns very different values when issued from java/Hibernate vs SqlDeveloper tool.
@SequenceGenerator(name = "PARAM_ID_SEQUENCE", initialValue = 10, allocationSize = 30, sequenceName = "PARAM_ID_SEQUENCE")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PARAM_ID_SEQUENCE")
@Column(name = "PARAMETER_ID")
The above returns 1177248345. I turned the loglevel to trace to see the actual query being issued and it is: select SPS_PARAM_ID_SEQUENCE.nextval from dual
.
Now I issue the very same query against the same sequence from sql developer tool and it returns: 39241615
which is 2 orders of magnitude lesser! Also, this is the accurate value I would expect.
CREATED 03-OCT-14
LAST_DDL_TIME 25-JAN-18
SEQUENCE_OWNER API
SEQUENCE_NAME PARAM_ID_SEQUENCE
MIN_VALUE 1
MAX_VALUE 9999999999999999999999999999
INCREMENT_BY 1
CYCLE_FLAG N
ORDER_FLAG N
CACHE_SIZE 20
LAST_NUMBER 39241624
PARTITION_COUNT
SESSION_FLAG N
KEEP_VALUE N
I confirmed that both are issuing requests on the same environment against the same database schema etc, but for some reason Hibernate gets a much higher value. Has anyone faced a similar issue. Is hibernate "padding" the sequence somehow?