Managing SERIALs in a generated application

You can define a primary key column as a SERIAL to use sequence numbers for the keys. BAM manages the SERIAL columns by using a single table named seqreg in the meta-schema (4dbx).

The seqreg table

For generated applications, BAM automatically adds a seqreg table to a new meta-schema (4dbx) to facilitate sequence number management for SERIAL columns. The seqreg table contains two columns; one with the name of the table having a SERIAL column and one with the last SERIAL column value for that table.

No configuration required

Once you have created a table with a SERIAL defined as the primary key, BAM manages sequence number generation and generates all code necessary to handle inserting the new sequence number during an Add operation. No addition configuration or modeling is required.

You may initialize the seqreg table with the appropriate records otherwise SERIAL columns will start at number 1.

If the database schema does not contain SERIAL columns, the seqreg table is not required in the schema.

Informix databases

The seqreg table is required in a schema containing SERIAL columns except for Informix® databases where the native Informix SERIAL management is used.
For further information on how the seqreg table is used, see the BDL User Guide, "Solution 2: Generate serial numbers from your own sequence table".