Annotating an attribute
Tagged values on an
attribute
The tagged
values used to annotate attributes are presented in the following table:
|
The ... tagged value |
Role |
SQL |
|
{sqlDefault(default_value} |
Used to specify a default value for the attribute. |
|
|
{globalTable(table_name)} |
Indicates that the attribute will be generated in a global table (this
applies only to class attributes). |
|
|
{indexKey(index_name,rank)} |
Indicates that the attribute participates in the definition of an
index. |
|
|
{primaryKey(rank)} |
Indicates that the attribute is the primary key of the table in which
the attribute is defined. This tagged
value contains one parameter, used to specify the order of the field, if the
primary key is made up of several attributes. |
|
|
{foreignKey(table_name,column_ name [constraint_name])} |
This indicates that the attribute is a foreign key defined on a table. |
|
|
{compositeKey(key_name,rank)} |
Indicates that the attribute participates in the definition of an
index. This tagged value has two
parameters, used to specify the name of the index, and the order in which the
attribute will be defined in this index.
This type of index must be defined for a table. |
|
|
{persistence(type_persistence)} |
Indicates in the analysis model whether or not the attribute is
persistent. |
|
|
{sqlType(specific_type)} |
Allows the used of specific types, such as LONG, RAW, LONG RAW, LONG
VARCHAR, and so on. |
|
|
{alterTable} |
Indicates to the MDAC that it should generate a "unit_name_alter.sql"
file for each table containing attributes annotated {alterTable} |
|
|
{sqlDoNotGenerate} |
Indicates to the SQL generator that it should not take into account
the (Attribute) column. |
{sqlDoNotGenerate} |
The {sqlDefault}
tagged value
The {sqlDefault}
tagged value indicates the default value in the SQL
table. This tagged value is used to
express a default value which is not equal to that of the standard
"Expression of value" field.
The {globalTable}
tagged value
The
{globalTable} tagged value is only used on class attributes. It indicates whether the class attribute
should be generated in a global table, which groups together all class
attributes. The structure of this table
is explained in "Class attributes" paragraph of the "Attributes" section.
This tagged
value's parameter specifies the name of the global table. If this tagged value is not defined, the
attribute will be generated in the table specific to the class attributes of
the class.
The {indexKey}
tagged value
The {indexKey}
tagged value indicates that the attribute
participates in the definition of an index.
This tagged value contains two parameters - the name of the index, and
the order in which the attribute will be defined in this index. The class or the table must be annotated
{indexName(index_name)}.
The {primaryKey}
tagged value
The {primaryKey}
tagged value indicates that the attribute is the
primary key of the table in which the attribute is defined. This tagged value contains one parameter,
used to specify the order of the field in the primary key.
The {foreignKey}
tagged value
The {foreignKey}
tagged value indicates that the attribute is a foreign key
defined on a table. Two parameters are
necessary with this tagged value - the name of the class containing the referenced
attribute, and the name of the attribute itself. The third parameter is only necessary if more
than one foreign key constraint exists between the same two tables.
The {compositeKey}
tagged value
The {compositeKey}
tagged value indicates that the attribute participates in
the definition of a composite key. This
tagged value has two parameters - the name of the key, and the order in which
the attribute will be defined within this key.
The class or the table must be annotated {keyName(key_name)}.
The {persistence}
tagged value
The
{persistence} tagged value is used to specify whether or not the
attribute is persistent. If its
parameter is (persistent), then the attribute is persistent and has an
equivalent in the physical model (a column).
If the parameter is (transient), then the attribute is not persistent.
The {sqlType}
tagged value
The {sqlType}
tagged value indicates that the MDAC should use a
specific type given as a parameter.
Available types differ according to the RDBMS selected at MDAC parameter
level. It is possible to customize
generation, by modifying existing types or creating new types in the types
package.
The {alterTable}
tagged value
The {alterTable}
tagged value is used to indicate that the MDAC should generate a
"unit_name_alter.sql" file for every existing table which contains
attributes annotated in this way.
The
{sqlDoNotGenerate} tagged value
The {sqlDoNotGenerate}
tagged value indicates that SQL Designer should not generate SQL code for the
table represented by this attribute. Be
careful not to mark all a table's primary keys with this tagged value, as this
could lead to the generated SQL code no running correctly.