ObjectGears Help

Forum   ObjectGears (Version:

Use of column of the reference type

Reference to another class

If we use column of the reference type, we will select values into it from another class of the same model or another class of another model, if this class was enabled for references from another models (it has to be specified which particular model can refer to such a class).


Example is Vendor, Owner or Operating system which can be attributes of the class Server. Since we want to ensure data purity and integrity and have several possible server vendors, server owners and server operatin systems, we will choose by definition of these attributes column type reference to another class. Before that we will prepare classes in which we will define Vendors, Owners and Operating systems.  By definition of the given server attributes we will select corresponding class, from which we will select particulat values of Vendors, Owners and Operating systems.

When defining reference class it should be considered if we want to use it only in this model (this may be case of Operating system in the model of IT technology) or in more models (this may be case of Owner which may be used both with IT technology and with other company property). In the first case it is correct to define the reference class within the model that will use the reference class. In the latter case it may be worth to consider creating a special model for generally shared master data and defining and maintaining the reference class in it.

Structure of master data (relations between classes) may be more complex. We may want to keep a record of the city, in which the owner has its headquarters. Then we shall refer to the class Cities in the column City of the Owner class. Similarly, we may want to keep a record of the district in which the city belongs. Thoughtful design of relations ensures data consistency and will reflect relations of the real world in an adequate way.


Sorting in the list from which we select into the column of the reference type

When we are selecting values into the column of the reference type, list of records from the class is displayed to the user. If necessary, sorting in this list can be different from the sorting in the referred class. This soring can be set in the definition of the reference type column.

Class for record restriction

In case of more complex relations data integrity can be facilitated by the property of the reference type column that is called Class for record restriction. In the model stated hereinafter we select data in the class LookUpTable from the class Database and from the class Table, where record in the class Table has also property Database.  (Relation of classes Database and LookUpTable seems to be redundant and not compliant with 3. NF,however object variability may lead to selection of similar models with aim to simplify the model and limit the number of classes.)



When inserting records into the class LookUpTable, we want, that after selecting Database only those records from the class Table are displayed for selection, that have this Database.  This can be achieved by setting up Database as class for record restriction in the column id_Table in the class LookUpTable. This will ensure that we will not select by mistake a table belonging to another database than is the selected database.

Reference to user

It is possible to refer to the ObjectGears user in the columns of the reference type. This enables to define e.g. who is responsible for task completion or application/server maintenance.

Reference to one or more records

It is possible to refer to one or more records in the column of the reference type.

Display of the relation in the class at the end of the relation

After creating a new column of the reference type in the class X referring to the class Y, ObjectGears will automatically create a corresponding column in the class Y displaying the relation to the class X.

This column exists, however is not displayed by deafult in neither of the three possible displayes of the class Y. The code of this column is automatically generated in form cl-[class name]-[x], where [x] is the first free number. The name of the class is generated in form [name of the class that is referring] - [name of the column that is referring]. This name, display and some other parameters of this automatically generated column can be modified. This column si automatically removed when the referring column is removed.

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information