In this post we will see how to use a oracle sequence in database adapter.
In some cases where you want to use the database adapter for inserts data in to a database table , you may want to use native sequencing to populate a primary key for some field.
I have created a below table and sequence in oracle database and i wanted use this table and sequence from SOA using database adapter.
CREATE TABLE TEST_SEQ_TAB (“ID” VARCHAR2(4000 BYTE) NOT NULL ENABLE,
“SOURCE” VARCHAR2(4000 BYTE) NOT NULL ENABLE,
“TARGET” VARCHAR2(4000 BYTE) NOT NULL ENABLE,
“CREATE_TIME” TIMESTAMP (6) NOT NULL ENABLE,
“ATTRIBUTE1” VARCHAR2(250 BYTE),
“GUID” VARCHAR2(400 BYTE)
CREATE SEQUENCE TEST_SEQ INCREMENT BY 1 START WITH 1 NOMAXVALUE MINVALUE 1;
Now i have created a Database adapter to use this sequence.
For using this sequence we have to use “native sequencing” in DB adapter in primary key column.
You can see the primary key column in the table is linked with sequence in the mappings file .