Skip to main content
Version: Previous

Fields - advanced

warning

This page is only for users of GSF version 7.1 or earlier.

Click here for details of how to define these details in the current version.

Modularity

Genesis is modular, so if you have a dependency on another module (e.g. Auth), your project naturally inherits all the fields from that module and and they are available in your project.

It makes sense to re-use fields in dependent modules wherever possible; this cuts down your need to define field names that are unique across all modules and the project itself.

Scripting

GPAL is a scripting language that gives engineers plenty of advantages, especially when it comes to repetition.

For example, where you need to create a large number of table fields, say ALGO_PARAM_1 through to ALGO_PARAM_50, you can introduce for loops:

  val algoParamPrefix = "ALGO_PARAM_"
for(i in 1..51) {
field(name = algoParamPrefix + i, type = STRING)
}

Default empty values and non-nullable STRING fields

You can define an empty and non-nullable STRING field as:

field(name = "REFERENCE", type = STRING, default = "", nullable = false)
danger

Although this is a valid set-up by ANSI SQL standards, Oracle currently doesn't support this configuration, leading to failed database writes.

If you want to implement this set-up in Oracle, you have a choice of how to do it:

  • Change all default values to have at least one character.

OR

  • Provide a SysDef level override property: OracleEmptyStringFieldDefaultValue, with at least one character.

For maximum simplicity and compatibility, consider simply declaring the field as nullable:

field(name = "REFERENCE", type = STRING)

Precision and scale

The Genesis platform has predetermined column sizes, so the platform automatically translates the field types into the most suitable precision and scale.

The tables below provide details of the translation for each field type, depending on the database technology used.

Postgres

Genesis data typePOSTGRES data type
INTint4
STRINGvarchar(64)
DATEint8
DATETIMEint8
ENUMvarchar(64)
LONGint8
SHORTint2
DOUBLEfloat8
BIGDECIMALnumeric(20, 5)
NANO_TIMESTAMPint8
RAWbytea

ORACLE

Genesis data typeORACLE data type
INTNUMBER(38,0)
STRINGVARCHAR2(64)
DATENUMBER
DATETIMENUMBER
ENUMVARCHAR2(64)
LONGNUMBER
SHORTNUMBER(38,0)
DOUBLEFLOAT
BIGDECIMALNUMBER(20,5)
NANO_TIMESTAMPNUMBER
RAWBLOB

SQL SERVER

Genesis data typeSQL SERVER data typeSQL SERVER data lengthSQL SERVER data scaleSQL SERVER data precision
INTint410
STRINGnvarchar64
DATEbigint819
DATETIMEbigint819
ENUMnvarchar64
LONGbigint819
SHORTsmallint25
DOUBLEfloat853
BIGDECIMALnumeric13520
NANO_TIMESTAMPbigint819
RAWvarbinary-1