What is the difference between setting nullok=false
or true
for the typekey field?

- 2,363
- 1
- 14
- 29

- 11
- 1
3 Answers
This means that field can contain Null values or not.
nullok = false -> do not allow null value nullok = true -> allow null values

- 11
- 1
-
So a typekey field can be nullable as any other field on the entity with nullok=true – hakamairi Feb 18 '21 at 09:35
Nullability of a column (nullok = true
) makes it possible to persist the object even when the value for given field is missing.
Non-nullable column (nullok = false
) does not allow missing values.
It should, however, be remembered, that this distinction is on the logical level and might not map directly to database limitations.
While a nullok=true
column will always be nullable in the database, the nullok=false
column is only non-nullable if the field is declared on the base (top level) entity. If the field comes from a subtype, the field on database level will still be technically nullable.
This is necessary because Guidewire keeps all the subtypes in a single table. A non-nullable column on a subtype would make it impossible to persist objects of subtypes that do not have related Property defined at all.

- 11
- 1
When we set a Database Table Column to
NULLOK = FALSE, then that field should always have valid data or a default data written during every new record created or updated.
NULLOK = TRUE, then that field may or may not have valid data or a default data written during every new record created or updated.
Significance of the NULLOK : We can restrict integration code or backend process to update the database column with NULL value by setting the nullok = FALSE

- 337
- 2
- 7