Defining a Reference Attribute

Now we can define our first reference attribute – Type, which is the reference to the ItemType object. We start in the usual manner and define the name of the new attribute Type and we select ItemType as the type of the attribute. Note that the objects that we have defined already appear in the list of attribute types – thus we can define a reference attribute by using the defined objects as an attribute type. Now we need to define other properties of the reference attribute – we tick the “Required” checkbox to indicate that an Item cannot live without an associated ItemType and we leave “Multiple allowed” checkbox un-ticked to indicate that the Item object may refer only to one instance of the ItemType object.

We will define a matching attribute in the ItemType object. We will click on the “Matching Data” property and in the dialog that appears we will select the “Create” radio button and give a name to the matching attribute (Items). Once we save the Item object the attribute with this name will be automatically created in the ItemType object. This will create the relationship between the ItemType object and the Item object (the ItemType object would know all Items that belong to it). The beauty of this approach is that when we create a particular instance of the Item object in the Operation Mode and link it with a particular instance of the ItemType object, the instance of the ItemType object would automatically add the newly created Item to its list of Item objects that belong to this item type. This means that when you navigate to the ItemType object you will see all instances of the Item object that belong to this type and you can navigate to any of them! It is generally a good idea to be able to see the relationship from instances of both objects; it is also handy to be able to navigate to the related objects from both sides of the relationship. The “matching attribute” feature allows us to do precisely that.

Here we can also specify the type of the relationship between the Item object and the ItemType object – we will explain later what the relationship type is for. For now we will leave the relationship type as “Peer”.

Relationship types and matching attributes are described in detail in Reference Attributes.

We can now save the Item object by clicking on the “Save” button in the toolbar or selecting File/Save in the Configuration Tool menu.

note

when defining reference attributes we did not have to define extra database tables, foreign keys and link the tables, as most database systems would require you to do. AwareIM creates all the required database tables and links between tables automatically allowing you to simply describe relationships between your business objects.
  • Last modified: 2025/06/12 02:35