-
Notifications
You must be signed in to change notification settings - Fork 1
DAO ORM Configuration
version 1.0
status beta
mandatory
mandatory
-
name
String/mandatory/ The name of the entity property
-
dbName
String/mandatory/ The name of the database record column corresponding to this entity property
-
type
String/mandatory/ A valid type supported by the Database enterprise API. Note that it's the application type, not the SQL type , i.e. 'String', 'Long', 'Int' etc.
-
id
Boolean/optional/ true if this property is identity field (primary key of the data record), false otherwise.
Default: false
-
required
Boolean/optional/ true if this property can be undefined (null in db record terms), false otherwise.
Default: false
-
unique
Boolean/optional/ true if this property value must be unique in the table, false otherwise. Insert for entity with property with constraint unique will fail if there is already another entity whose property has the same value.
Default: false
-
size
integer/optional/ if the type implies size (such as the character types) it can be provided with this property. The concrete dialect will choose the appropriate SQL character type for the size that you specify. The default size if none is specified with this property varies by dialects.
-
value
Function(dbValue)/optional/ A transformation function that performs custom conversion from the data record field value to javacript value. Must return a valid JavaScript value for this property type. Useful e.g. for persisting dates as type long and still provisioning them as dates in the entity application model. Parameters:
-
dbValue
ObjectThe value of this property in the data record JSON object to transform to entity JSON value.
-
dataRecordEntity
ObjectThe data record JSON object that is being transformed to entity JSON.
Returns: The transformed JSON entity value for this property.
Default: The default transformation converts database record nulls to undefined in the resulting JSON object.
-
-
dbValue
Function(value)/optional/ A transformation function that performs custom conversion from the entity property value to the corresponding data record field value. Must return a valid database value for this property type. Useful e.g. for persisting dates as type long and still provisioning them as dates in the entity application model. Parameters:
-
value
ObjectThe value of this property in the entity JSON object to transform to data record value.
-
entity
ObjectThe entity JSON object that is being transformed to data record JSON.
Returns: The transformed data record JSON value for this property.
Default: The default transformation converts JSON object undefined properties to null values in the resulting javascript data record object.
-
-
allowedOps
Array of String/optional/ The operations allowed to consider this property. Valid strings are
insert
andupdate
. For example,allowedOps: ['insert']
means that on insert of an entity this property can be assigned value and then becomes immutable, i.e. a subsequent update on this entity will not attempt to modify the property even a value has been provided.Default: undefined
optional
-
type
String/mandatory/ This association multiplicity. One of
one-to-many
,one-to-one
,many-to-many
,many-to-one
. -
joinKey
String/mandatory/ The name of the field in the related (target) entity dao configuration that is used to join this entity. The foreign key field in relational terms.
-
key
Stringoptional The field in this entity, on which related entities are joined. Normally, that would be the primary key of the data record but not necessarily as any other unique, non-null field would do. For the latter cases, use
key
to specify that field.Default: The primary key field in this entity.
-
targetDao
Function/mandatory/ A factory function for the relate (target)d entity DAO instances.
-
joinDao
Function/mandatory for 'many-to-many' association type/ A factory function for the join entity (table) dao. Valid for
many-to-many
association type only.Note The joinDao must feature a
listJoins
function with single parametersettings
of type object. The function will be invoked to transitively list the target related entities. Thesettings
parameter object will feature:- sourceDao DAO object : This dao object
- joinDao Object : The dao object on which the listJoins function is invoked
- targetDao DAO Object : The dao object whose record we want to refer to as target ultimately
-
defaults
Objectoptional Provides the arguments for the list function used to retrieve the
many
entities with their dao. By default no arguments are provided. This property will be ignored for all types of associations butone-to-many
.