Mapping Data Types Between Relational Data Models and UML Class Diagrams

Technote (FAQ)


Mapping Data Types Between Relational Data Models and UML Class Diagrams


System Architect enables you to model the static structure of your database design with logical and physical relational data models, and the structure of your applications and databases with UML Class diagrams. You may automatically map diagrams between all three diagram types, going, for example, from a UML Class diagram to a logical ER diagram to a physical data model, or vice versa.

As you move between modeling domains, certain transformations need to be made. For example, let's say you have reached a design stage with a UML Class diagram, and specified language-dependant types for your attributes. Your implementation language might be Java, or C++, or VB, or some combination thereof. If you are using a relational database to implement your database design, you may want to map the your persistent classes to a relational data model, where you can develop the design of the database.  

Class Diagram to Relational ER Diagram

In System Architect you may map this UML Class diagram to a Logical ER diagram. However, the Logical ER diagram knows only of generic ANSI data types. System Architect will automatically map your Java types to the best equivalent ANSI-generic data type.

Source Type
Target Type
Java Pre-Type Java Type Java Post-Type Data Element Type
boolean bit
byte tiny integer
short small integer
int integer
long long binary
float float
double double precision
const char character
char character varying
const char * long character
char * long text
char * long var character
default long var character

If this mapping is not sufficient, you may also specify, for each class attribute, an underlying data element. This data element can have an ANSI-generic data type specified. When mapping the class diagram to a data model, if a class attribute has an underlying data element specified, it will be the data element that will be mapped to the ER diagram.

Let's Look at an Example...

In this example, we start with a UML class diagram with Java properties specified for both classes. Both classes are persistant. We wish to map these classes to a relational data model. 

Class Diagram with 
Java Data Types

In this example, we wish to specify that the attribute Total_Price has a data type of Decimal. This data type is not available in Java, nor is there any equivalent. We can, however, specify an underlying data element (named Price) for this attribute. We may specify Decimal as an ANSI data type for this element.

Specifying Underlying 
Data Element to a 
Class Attribute

While we're at it, we may specify a primary key or keys for each class.

Specifying Primary Key 
for a Class

We choose Dictionary, Convert to ER Diagram, and the persistent classes on our class diagram are mapped to a logical data model, with relationships. 

Logical ER Diagram Automatically 
Created from Class Diagram

Class attributes are mapped to attributes in each entity. Java data types are mapped to the equivalent ANSI data type. Underlying data elements are created for each entity attribute, except for the class attribute Total_Price, which already has an underlying data element of Price, specified above. The Decimal data type is mapped over.

ANSI-Generic Data Types
 in Logical ER Diagram

Logical ER Diagram to Physical Diagram

You may design a normalized logical data model, and then map this to a physical diagram. The physical diagram will be completely separate from the logical diagram, enabling you to maintain the logical view while making changes to the physical design. 

The physical diagram is tied to the implementation DBMS that you choose. When you create a physical diagram, you must choose the DBMS. You may create multiple physical diagrams for a logical ER diagram, each with a different DBMS specified.

Another mapping of data types is performed when going from a logical ER diagram to a physical diagram. The ANSI-generic data types of the logical model are mapped to the best-equivalent match for the specified DBMS. 

In our example, we map our logical ER diagram to an Oracle implementation.

Physical Diagram, with Oracle Data Types

Historical Number


Rate this page:

(0 users)Average rating

Add comments

Document information

More support for:

Rational System Architect
General Information

Software version:

11.0, 11.1, 11.2

Operating system(s):


Reference #:


Modified date:


Translate my page

Machine Translation

Content navigation