balkje gen website
Bekijk de website in Nederlands.

Modeling tip 3 : Identifiers and Source Code

 

Sometimes in a Data Model two (or more) identifiers are defined for one Entity Type. Then you have to be aware of the fact the the performance of a READ action in the database may be influenced in a negative way because of those multiple identifiers.
In the text below you'll find an explanation.

1. Entity Type Customer
In a Gen model the entity type Customer with 5 attributes has been defined. There is only one identifier: the attribute number.

Entity Type

Customer

I   number

name

address

city
phone


2. The Action Diagram including the statement READ customer
In the following Action Diagram the attributes number and phone of this entity type customer are read from the database: 


3. Generated code (one identifier)

After generation (Windows) of the source code from this Action Diagram, the following SQL  can be found:


The Select statement will retrieve the attributes number and phone from the Customer table.
Two attributes of one table are read.

You may expect that the generated source code always will contain a SQL Select statement that refers to only those two attributes, because the Entity Action View only includes those two attributes.
However, this is not always the case. Which SQL statement will be generated, also depends on other aspects in the model, not mentioned in the Action Diagram.

If more than one identifiers have been defined for the Entity Type, there are consequences for the generated source code.
It is explained below.

4. Entity Type Customer with two identifiers
Now the Entity Type Customer includes two identifiers:

1. one attribute: number
2. three attributes: name + address + city


In the model you'll see:

Entity Type

Customer

I   number

I   name

I   address

I   city

phone

5. Het Action Diagram met READ customer
The Action Diagram is not changed and stays as mentioned above. The Entity Action View still includes only the attributes number and phone.

6. Generated source code (two identifiers)
Once the source code has been generated, the following SQL statement can be foud:

Not only the the attributes number and phone are retrieved, but also the three attributes name, address and city, included in the second identifier .
This may have negative consequences  for the performance of applications. 

7. Result
For these reasons many organizations only define one and only one identifier for each Entity Type.
NB: When modeling according CBD standards, only one artificial identifier is defined. Only the one identifier will be read.

Courses


© Educagen | disclaimer | info@educagen.com |

Gen also known as: CA Gen, AllFusion Gen, Advantage Gen, coolgen, IEF and Composer.

Cool:gen contact