Examples of Model File Errors¶
This page includes some common model file errors with a proposed solution. Observe the the same error might have several different solutions. Observe also that the list doesn't include all errors that could occur.
Different Column Declaration¶
EXPECTED==========================================================
--> DEFAULT_CONS_ACCNT VARCHAR2(10) NULL
RESULT============================================================
--> DEFAULT_CONS_ACCNT VARCHAR2(20) NULL
==================================================================
Solution: Change the model to be equivalent with the database table, in this case increase to 20 characters in the model.
Attribute only exist in the model¶
EXPECTED==========================================================
--> CONS_COMPANY VARCHAR2(20) NULL
RESULT============================================================
==================================================================
Solution: Add DERIVED for the attribute in the model, maybe also DbSqlImplementation need to be added.
Length of enumeration differs between model and database column¶
EXPECTED==========================================================
--> LOGICAL_ACCOUNT_TYPE VARCHAR2(20) NOT NULL
RESULT============================================================
--> LOGICAL_ACCOUNT_TYPE VARCHAR2(1) NOT NULL
==================================================================
Solution: The default length for enumeration column in a table is always 20, but you might override it to any length you want. In this case you should add a codegenproperty as DbTableColumnDeclareType "VARCHAR2(1)".
Boolean is default number¶
EXPECTED==========================================================
--> IS_CODE_PART NUMBER NOT NULL
RESULT============================================================
--> IS_CODE_PART VARCHAR2(5) NOT NULL
==================================================================
Solution; An attribute declared as type boolean is defaut generated as number, but you might want TRUE or FALSE instead. In this case change the model and add ("TRUE", "FALSE") after BOOLEAN key word . In this example: IsCodePart BOOLEAN("TRUE","FALSE")
Column exist in table but not in the model¶
EXPECTED==========================================================
RESULT============================================================
--> CORRECTION VARCHAR2(1) NULL
==================================================================
Solution: No standard recommended solution exist. There could be several different solutions in order to get rid of this problem.
Column mandatory in table but not in the model¶
EXPECTED==========================================================
--> MY_CODE_PART VARCHAR2(5) NULL
RESULT============================================================
--> MY_CODE_PART VARCHAR2(5) NOT NULL
==================================================================
Solution: A value can't be set before insert method, typically a sequence, why we cannot have not null check in the unpack_check_insert___ method. In order to reflect that the column in the table is mandatory, you add the following codegentproperty, DbTableColumnNullable "false". If the value is not set in the insert___ method then the model needs to be changed and the attribute must have the mandatory flag.
Column mandatory in model but not in the table¶
EXPECTED==========================================================
--> ROWVERSION DATE NOT NULL
RESULT============================================================
--> ROWVERSION DATE NULL
==================================================================
Solution: Standard columns like rowversion should always be mandatory in the table. Modify the upg and cdb files and set a default value.