I have made a table in oracle which uses auto incremented field thorough sequence.
Here is the sql:
CREATE TABLE Users(
   user_ID   INT          NOT NULL,
   user_name VARCHAR (20)     NOT NULL,
   user_password  VARCHAR (20)              NOT NULL,
   user_role  INT  NOT NULL,
   PRIMARY KEY (user_ID)
);
ALTER TABLE Users 
   ADD FOREIGN KEY (user_role) REFERENCES User_Roles (role_ID);
CREATE SEQUENCE seq_users
MINVALUE 1
START WITH 1
INCREMENT BY 1
CACHE 10;
Now I need to insert the data into the table through a java program, is there any way, I don't have to use the query like this:
Insert into User_Roles values (seq_user_roles.nextval,'system admin');
User Role Table:
CREATE TABLE User_Roles(
       role_ID   INT              NOT NULL,
       role_name VARCHAR (20)     NOT NULL,
       PRIMARY KEY (role_ID)
);
CREATE SEQUENCE seq_user_roles
MINVALUE 1
START WITH 1
INCREMENT BY 1
CACHE 10;
I want to insert the data from a java program and can't specify that name of the sequence.
 
     
    