Hello,
I surely have missed something in the documentation but I don't find what :)
I am inserting a new object in an Oracle Database.
It fails on an fValidation exception because the "user_id" column "cannot be null" (among other columns). Indeed. But I do not give the user_id on purpose, because it is automatically filled by a trigger + sequence, like mysql autoincrement feature.
What should I do to avoid this kind of behaviour?
I am using the last version of flourishlib.
BTW, other colums, which HAVE a default value, are also reported as requesting a value by fValidation.
Table is the following in Oracle :
CREATE TABLE "ITPNET"."USERS"
( "USER_ID" NUMBER(10,0) NOT NULL ENABLE,
"USERNAME" VARCHAR2(45 BYTE) NOT NULL ENABLE,
"FIRSTNAME" VARCHAR2(45 BYTE) DEFAULT 'User' NOT NULL ENABLE,
"LASTNAME" VARCHAR2(45 BYTE) DEFAULT 'User' NOT NULL ENABLE,
"EMAIL" VARCHAR2(255 BYTE),
"ARCHIVED" NUMBER(3,0) DEFAULT 0 NOT NULL ENABLE,
"CREATED_AT" DATE DEFAULT SYSDATE NOT NULL ENABLE,
"MODIFIED_AT" DATE DEFAULT SYSDATE NOT NULL ENABLE,
"LOCATION" VARCHAR2(30 BYTE) DEFAULT 'HIDE' NOT NULL ENABLE,
"NUMLOGINS" NUMBER(10,0) DEFAULT 0,
CONSTRAINT "PRIMARY_8" PRIMARY KEY ("USER_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "ITPNET" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "ITPNET" ;
CREATE OR REPLACE TRIGGER "ITPNET"."USERS_USER_ID_TRG" BEFORE INSERT OR UPDATE ON users
FOR EACH ROW
BEGIN
if inserting and :new.user_id is NULL then
SELECT users_user_id_SEQ.nextval into :new.user_id FROM DUAL;
end if;
END;
/
ALTER TRIGGER "ITPNET"."USERS_USER_ID_TRG" ENABLE;
Thanks for your help !