Friday, June 28, 2013

Implement Primary Key Population for ADF BC based on SQL server

We can auto populate the primary key attribute in many ways for an ADF BC Entity Object based on Oracle Database but for the Entity Objects generated using SQL Server the following proceedure should be used

Step 1. Create an auxiliary database table
Create an auxiliary database table that will be used to generate the primary key values as shown below.

CREATE TABLE [dbo].[S_ROW_ID](
[start_id] [numeric](38, 0) NULL,
[next_id] [numeric](38, 0) NULL,
[MAX_ID] [numeric](38, 0) NULL,
[AUX_START_ID] [numeric](38, 0) NULL,
[AUX_MAX_ID] [numeric](38, 0) NULL
)

Step 2. Create the database Connection 
ROWIDAM_DB
In your application, create a database connection named ROWIDAM_DB that points to the database containing your S_ROW_ID table.
Note: It is mandatory to use the same connection name

Step 3. Configure the Primary Key Attributes 
Set the primary key attribute value to oracle.jbo.server.uniqueid.UniqueIdHelper.getNextId() in the Entity Object as shown below



Step 4. Modify the adf-config.xml
Though we create the connection to the sql server, we need to modify the default preferences in adf-config.xml as shown below.