Skip to content

DAO ORM Configuration

shturec edited this page Feb 23, 2017 · 12 revisions

version 1.0

status beta

dbName String

mandatory

properties Array[property]

mandatory

property Object

  • name String /mandatory/: the name of the entity property
  • dbName String /mandatory/: the name of the database record field 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.
  • id Boolean: true if this property is identity field (primary key of the data record), false otherwise
  • required Boolean: true if this property can be undefined (null in db record terms), false otherwise
  • unique Boolean: 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.
  • size integer: 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.
  • value Function(dbValue): 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.
  • dbValue Function(value): 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.
  • allowedOps Array of String : The operations allowed to consider this property. Valid strings are insert and update. 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.

associationSets Object

optional

  • {association-name} association Object

association Object

  • associationType String /mandatory/: This association multiplicity. One of one-to-many, one-ot-one, many-to-many, many-to-one.
  • joinKey String: The name of the filed in the related entity dao configuration that is used to join this entity
  • defaults Object: 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 but one-to-many.
  • dao Function: A factory function for the related entity DAO instances. Valid for all but many-to-many associations.
  • daoJoin Function: A factory function for the join entity (table) dao. Valid for many-to-many association type only.
  • daoN Function: A factory function for the N-end dao in an M-to-N (many-to-many) relations. Valid for many-to-many association type only
Clone this wiki locally