Module mapping

Provides a Mapping constructor representing the mapping definition of an entity defined within a store.


Mapping (type, definition)

Constructs a new Mapping instance

Parameters

String type The entity type this mapping belongs to
Object definition The mapping definition

Returns

A newly created Mapping instance

Mapping.prototype.columns

A map containing the property mappings by column name


Mapping.prototype.getColumnName (property)

Returns the column name for the given property

Parameters

String property The name of the property

Returns

String The name of the column

Mapping.prototype.getColumnType (property)

Returns the column type for the given property

Parameters

String property The name of the property

Returns

String The column type

Mapping.prototype.getMapping (property)

Returns the mapping for the given property name

Parameters

String property The property name to return the mapping for

Returns

PrimitiveMapping|ObjectMapping|CollectionMapping The property mapping

Mapping.prototype.getQualifiedColumnName (property, dialect)

Returns the qualified column name, prefixed with the table name. Both the column and the table name are enclosed in database specific quotes.

Parameters

String property The name of the property
Dialect dialect The database dialect to use for quoting

Returns

String The qualified column name

Mapping.prototype.getQualifiedTableName (dialect)

Returns the qualified table name, prefixed with an optional schema name. Both the table and schema name are enclosed in database specific quotes.

Parameters

Dialect dialect The database dialect to use for quoting

Returns

String The qualified table name

Mapping.prototype.id

The ID mapping


Mapping.prototype.isCollectionMapping ()

Returns true if this mapping is an instance of CollectionMapping

Returns

Boolean True if a collection mapping, false otherwise

Mapping.prototype.isObjectMapping ()

Returns true if this mapping is an instance of ObjectMapping

Returns

Boolean True if an object mapping, false otherwise

Mapping.prototype.isPrimitive ()

Returns true if this mapping is an instance of PrimitiveMapping

Returns

Boolean True if a primitive mapping, false otherwise

Mapping.prototype.properties

A map containing the property mappings by property name


Mapping.prototype.schemaName

The schema name


Mapping.prototype.store

The store this mapping belongs to

See


Mapping.prototype.tableName

The table name of this mapping, or the entity type name if not specified in the mapping definition


Mapping.prototype.type

The entity type name this mapping belongs to