Reputation: 1371
CREATE TABLE GROUPS
(GROUP_ID INT NOT NULL GENERATED ALWAYS AS IDENTITY
(START WITH 100, INCREMENT BY 1), ADDRESS VARCHAR(100), PHONE VARCHAR(15));
I am using the above line to create a Table in JavaFX but every time I close out of the application after entering new data the sequence numbering for the ID jumps ahead by 100 so if I enter 3 records with the first sign on my sequence is 100 101 102 close the program and reopen and enter 3 more records the sequence is 200 201 202 What variable is storing this value and why does it increment by 100 with each sign on? Or How do I correct this problem? the database is DerbyDB and it is Embedded with the application in a folder on C drive, ID is set as the Primary Key
Upvotes: 1
Views: 77
Reputation: 3235
@James_Duh
How are you closing the database I have an idea you might be missing this line of code
DriverManager.getConnection("jdbc:derby:;shutdown=true")
hope this helps @Strawberry nice edit where is the answer
Upvotes: 1