An Entity is a title bar over a list of fields, each a name with an optional type and key. It is the box at the heart of an entity-relationship diagram and a UML class diagram alike, and the place a data model grows: entities add fields where they stand and join one another field to field, with the cardinality on each end.
Take the tour
The first time you select an entity, a small Show Me toolbar appears beside its toolbar. Press Play for a short walkthrough on your own entity: its title, its fields and keys, editing them in place and in the Fields menu, and joining entities. Press the cross if you would rather not; either way it is not offered again. To be offered it again, open Settings, then Tours, open Show Me and switch Entity back on.
Finding it
In Diagram mode, Entity is in the palette's Diagrams category, after the Table. In any mode you can also add it by name from the editor's Search panel.
Adding one and filling it in
Add an Entity. It arrives titled "Entity" with two example fields: id, the primary key, and
name, both typed string.
Double-click a field to edit it where it stands: the name, then Tab to the type. Enter saves and moves to the next field, and past the last one it adds a new field, so you can type a whole table without reaching for the mouse. Escape keeps what you typed, and a field you empty is removed.
Press the small key at the start of the field you are editing to give it a key: PK (primary key), FK (foreign key), PK FK (both, for a join table) or UK (unique). Each key shows as a glyph beside the field.
The box grows and shrinks with its fields, so a new field is never hidden below the bottom. You can also edit every field at once: right-click the entity and open Tools, then Fields, for a key button, a name, a type and a × per field, with Add Field at the foot.
An entity holds up to 40 fields, each name and type up to 80 characters. The type is optional: leave it blank for a rough sketch or an attribute list where the type does not matter.
Growing a model
Select an entity and press the + on any side:
- Add Related Entity puts a new entity on that side, already joined to this one. It comes with its own
idprimary key and a foreign key named after this entity (customer_idbeside "Customer"), and its title is ready to type. - Add Field, on the bottom +, starts a new field at the end.
Joining fields
Hover a field of the selected entity and a small dot appears on each side of it. Drag from a dot to a field of another entity: the line runs from field to field and stays on those fields as you move the entities. Dropping a line on an entity's title joins the whole entity instead.
A line joining two entities becomes a relationship as you let go, with crow's-foot ends: one at the table being pointed to, many at the end on a foreign key. Select it and press Cardinality in its toolbar to choose another pair: One to One, One to Many, Many to One, Many to Many, Zero or One to Many, or One to Zero or Many.
Modelling with them
- Data models. One entity per table, one field per column, with its type and key, and a relationship from each foreign key to the table it points at. The Database Schema template is a worked example.
- Class diagrams. Put attributes and methods in the same list; a method reads naturally as
render(): voidin the name column. - Relationships are ordinary arrows, so every arrow style applies; the arrowhead styles also include the hollow triangle (inheritance) and the filled and hollow diamonds (composition and aggregation) UML uses.
The title bar grows with the title's text size, so a larger title never collides with the divider under it.
Entities are ordinary elements underneath, so a theme recolours them, the format painter copies their look, and they export with everything else.
Was this article helpful?