The classes would be plain objects, pojos in java, what would be the UML relation between them, or there would not be any, but they would be related to other classes that used them?.
CodePudding user response:
The invoice_id
foreign key means that there is a structural relation between Invoice
and InvoiceLine
. You would therefore represent it as an association in the class diagram. Multiplicity would be by deduction 1
on Invoice
side 0..*
on InvoiceLine
side.
The technique is a classic of ORM called "foreign key mapping" by some authors. Use of soft identifiers rather than object references is also quite common, especially in complex real-life domains, to avoid having to load all the related objects when you fetch just one from the DB.
You may use the {id}
modifier to document primary keys:
A Property may be marked (...) as being (part of) the identifier (if any) for Classifiers of which it is a member. The interpretation of this is left open but this could be mapped to implementations such as primary keys for relational database tables or ID attributes in XML.
-UML 2.5.1 specifications