«Field»

Stereotype «Field» is used to map attributes of persistent objects to a relational database. Due to that the stereotype can only be applied on classes with stereotype «Persistent Object». Persistence frameworks will map attributes to the database using so called property mapping. This means that for every attribute there will be a row on the database. The mapping between Java and SQL type will be done automatically by default. Using tagged value sqlType it is also possible to define a custom mapping.

Attributes of persistent classes which do not have stereotype «Field» are considered to be transient.

Stereotype

Field

Applicable Elements

Property

Tagged Values

Name

Type

Description

rowName

String

Attribute defines the name of the row that is used when mapping the attribute to the database. If the name is not set then the name of the attribute is also used as row name of the table.

sqlType

String

Attribute defines the SQL type that is used to store the attribute on database level. Type can be used to override default behavior.

charLength

Integer

Attribute defines the amount of characters for an attribute on database level. Usage of this attribute is only supported for attribute in UML model is of type String. If the attribute is not set for strings then a length of 255 will be used as default.

precision

Integer

Attribute defines the precision that is used to store numeric values on the database. Attribute is only supported in combination with numeric values.

scale

Integer

Attribute scale defines the amount of digits that is used by the database to store the fractional part of a numeric value. The attribute is only supported in combination with attributes of classes that are having fractional types e.g. double.

index

String

Optional attribute can be used to define the name of a simple index for that attribute.

unique

boolean

Attribute defines if the attribute needs to be unique within the whole database table or not.

Default: false

notNull

boolean

Attribute defines if the attribute may be null on the database.

Default: true

 

For further information please refer to: