Monday, November 15, 2010

Activation creates duplicate row when primary key is populated through DB trigger ((Fixed in 11.1.1.4)

The same issue as previus post is also reproduced if Primary key is populated through database trigger and Pk attribute is defined as DB Sequence and refresh after insert.
Fusion Developer's Guide for Oracle ADF
4.10.10 How to Get Trigger-Assigned Primary Key Values from a Database Sequence

To run the test case you need to create database trigger :

CREATE OR REPLACE TRIGGER LOCATIONS_PK
BEFORE INSERT
ON "LOCATIONS"
FOR EACH ROW
BEGIN
IF INSERTING
THEN
IF :NEW."LOCATION_ID" IS NULL
THEN
SELECT LOCATIONS_SEQ.NEXTVAL INTO :NEW."LOCATION_ID" FROM DUAL;
END IF;
END IF;
END;

When you try to insert second line, first line is dublicated, when testing activation safe.


Test case

No comments:

Post a Comment