Aniket
January 23, 2018, 1:59pm
1
Hi Sir,
I am using generator type = Sequence in my pojo class.
But sir, now there is a problem in retrieving the object from database. It is returning id(primary key) = some negative value and showing following error:
Would you please help me resolving this…?
(note : I am using Oracle Database…)
vlad
January 23, 2018, 2:12pm
2
Go to the Oracle SQL console and run the following query:
SELECT last_number
FROM user_sequences
WHERE sequence_name = 'ID_SEQ';
If you get a negative value, then it’s because of how you created the ID_SEQ sequence.
To have positive values, create the sequence by specifying the START WITH
directive:
CREATE SEQUENCE ID_SEQ START WITH 1 INCREMENT BY 1;
Aniket
January 23, 2018, 2:41pm
3
No Sir,
It is returning positive value i mean correct value…
vlad
January 23, 2018, 3:01pm
4
Maybe you have inserted more than 40 Employee rows already and now the sequence returns positive values.
To be sure, log all JDBC statements using datasource-proxy
, as explained in this article .