Modeled Entities
A Modeled Entity is a main development object that represents a logical data aggregation such as a database table,a collection of records, user interface controls, or other data structure. It is an abstract object that is intended for re-use in other objects, such as components, variables, and parameters.
You can create modeled entities to define:
- Data that the application will access and maintain. This is most frequently stored in a relational database, but can also include other data sources such as XML streams for web services, files, and other internal and private data sources.
- Business rules that are applied to that data when it is created, updated, retrieved and deleted. Uniface provides default processing that ensures data integrity, but you can customize and extend behavior depending on the data.
- Default behavior and appearance of the data in components—whether a field is displayed as an edit box or a check box, as a list or in a radio group, and so on. Ultimately, this is determined in the component, but the defaults can be set in modeled entities and fields.
- Common functionality that can be reused in many components. For example, it is possible define sets of common user interface controls such as OK and Cancel buttons. These do not represent data but capture functionality.
Modeled entities are considered to be abstract objects because they cannot be compiled into executable files. Instead, modeled entities are reused in components to create the Component Entities that define the component's data. These component entities inherit the definitions in the modeled entity, and are compiled into the runtime component. When a component is activated at runtime, a component instance is created, and the component instance creates an empty occurrence of each component entity it contains. For more information, see Component Entities and Fields.
Modeled Data
A modeled entity usually represents a relational database table, but it is possible to define non-database entities for other purposes.
Note: If your application needs to access a database, you must define modeled entities to represent the data held in the database.
Modeled entities contain sub-objects that represent fields, key and index definitions, relationships, and aliases in a relational database.
Database Object | Modeled Development Object |
---|---|
Table | Modeled Entity |
Column | Modeled Field |
Primary key | Key |
Relationship | Relationship |
Alias | Modeled Subtype Entity |
If you define your modeled entities correctly, Uniface manages the data according to the relational model, regardless of the DBMS you use.
Modeled Behavior
Modeled entities have:
- Properties that can be used to declare basic data storage behavior and validation rules.
- Associated triggers for scripting behavior, such as retrieving data, adding or removing records (known as occurrences), and storing data.
Entity and Model Names
Each modeled entity must have a unique name that
may include a model name, as defined by the suffix following a dot in an entity name. For example,
in an entity called ORDER.ACMEORD
, ACMEORD
is the model name. The
model name is analogous to a database schema. An application can use more than one model, and
inter-model relationships are supported.
Modeled entities are considered part of the same model when they share the same namespace.