Applying "Digital Hub" Concepts to Enterprise Software Design, Part 2
Pages: 1, 2, 3
Creating ID Attributes (representing database columns):
- Highlight the DataType entity in the left frame of EOModeler by clicking it.
- Choose Add Attribute from the Property menu. Your new attribute should show up in the main window and in the Inspector. If you have closed the Inspector, please open it again before proceeding.
- With your new attribute selected, set the name field to
dataTypeIdand the column field toDATA_TYPE_ID. Set the external type tolongand the Internal Data Type to Integer. - In the main frame of the window, make sure that the key icon is showing next to your ID attribute and that the diamond icon is not showing. You can click the space next to the attribute to toggle this setting. See the screenshot below to make sure that you have it right.
- Create an ID column for the other two tables. The external and internal types are the same. Follow the same convention for the names, too: use
measuredDataIdandmeasurementTypeIdfor the names. UseMEASURED_DATA_IDandMEASUREMENT_TYPE_IDfor the columns. In each case, make sure the key icon is showing and the diamond icon is not. - Save your work.
Creating Attributes to store data:
- Highlight the DataType entity in the left frame of EOModeler by clicking it.
- Choose Add Attribute from the Property menu.
- Set the name of the new attribute to
nameand the column toNAME. - Set the external type to
charand the internal data type to String. When you select String as an internal type, a field will appear that allows you to set an external width. Type255in this field.
- For this attribute, make sure that the key icon is not selected and the diamond is selected. Note: This should be the default and is the opposite of the ID columns.
- Add a
nameattribute to theMeasurementTypeentity that is identical to the one you just created. In fact, you can use copy and paste to create it, if you want. To do this, select the attribute in the main window and choose copy. Then, select theMeasurementTypeentity and choose paste. - We're going to create two new attributes for the
MeasuredDataentity. The first one is to store a timestamp for each new piece of data that is entered. Create a new attribute, set its name totimeTaken, the column toTIME_TAKEN, the external type todatetime, and the internal type to Date. - Next, add an attribute to the
MeasuredDataentity to store the actual measured data. Since we do not know the type of the data for each row in the database ahead of time, we will set the data column to store a large string. Most other data types can be converted to a string. Set the name of the new attribute todata, the table name toDATA, the external type tochar, and the internal data type to String, with an external width of1024 - Double-check that every attribute except the ones storing ID numbers have the diamond visible and do not have a key icon. The measured data table will look like this:
Configuring Relationships
- Copy the
dataTypeIdattribute from theDataTypeentity and paste it into theMeasurementTypeentity. This will allow the measurement type to store a link to each row's data type. Set the attribute so that neither the key or diamond icons are showing (because it is not a primary key, and because this attribute will not normally visible to users). - Select the
dataTypeIdthat you just pasted into theMeasurementTypeentity. In the Inspector, view the Advanced Options for this attribute by clicking the second icon in the toolbar of the Inspector. There should be a checkbox to set whether or not to allow null. Make sure that it is checked so that null values will be allowed.
- Copy the
measurementTypeIdattribute from theMeasurementTypeentity and paste it into theMeasuredDatatable. This allows the measured data to store a link to its respective measurement type. Set the attribute so that neither the key or diamond icons are showing. - Set the newly pasted attribute to allow a null value (see step 2).
- Select the
MeasurementTypetable and choose Add Relationship from the Property menu. - Using the Inspector, name the relationship
dataType. Select the DataType table in the Entity selector. Then make sure that To One is selected, since there will be one data type for each measurement type. Finally select "dataTypeId" in both of the Join selectors and click connect. This is what it should look like:
- Select the MeasuredData table and choose "Add Relationship" from the Property menu.
- Using the Inspector, name the relationship
measurementType. Select theMeasurementTypetable in the Entity selector. Make sure that To One is selected, and then selectmeasurementTypeIdin both of the Join selectors and click connect. - Save your EOModel.
Your database schema is complete. To view it in a nice graphical form, use the icon on the far left of the toolbar to toggle to the table view. Your model should look something like this:

Create the Database
Once our EOModel has been created, it's no problem to create database tables that match the design. EOModeler can create the SQL code for you, and will even apply it to your database using the adaptor information that you specified earlier.
- Select the Weather entity from the left frame of EOModeler.
- Generate SQL in the Property menu.
- EOModeler will create all the SQL code necessary to set up your database.
- Uncheck Drop Tables and Drop Primary Key Support, since there is nothing in the database to drop.
- Click Execute SQL to apply the changes to the database.
- If you click the Tables... button and get a list of your three tables, then everything is good to go. If you get an error message, double-check all the model settings. For me, I often seem to forget to assign table names to attributes, so you might want to check that.
- When the tables have been created, save your work and quit EOModeler.

