UML Modeling Techniques > Data modeling > Storage Mapper > Generate prime keys > Generating prime keys (Storage Mapper)
Generating prime keys (Storage Mapper)
When you add an attribute to a class in a Class Model it has, by default, its textual property \u201cunique\u201d set to False. You can change this to True, in the attribute Property pages. This indicates that the attribute uniquely defines the instance of the class. A unique attribute is a suitable candidate for a prime key column, although for storage purposes, several attributes may in reality constitute a prime key.
When you select the Storage Mapper options, any attributes that are marked as unique are prefixed [u].
The options available in the Storage Mapper are arranged in descending priority from left to right. As the Storage Mapper only generates one prime key per table the following strategy is adopted:
If all boxes are checked, the prime keys are first deduced from attributes marked as unique, then from qualified attributes and lastly, are automatically generated from the table name.
You can generate prime keys from unique attributes or you can generate from qualified attributes. Therefore, if you want to generate a compound key from 2 or more non-unique attributes, you have to manually annotate the columns as prime in the logical data structure.
When you generate prime keys the propagation of foreign keys is automatic and mandatory. There is no method for prohibiting the propagation down a relationship.