Microsoft KB Archive/814727

= BUG: Incorrect Logical Database Model Is Generated When You Use the Create Table Inheritance Option in the ORM Source Model =

Article ID: 814727

Article Last Modified on 5/31/2007

-

APPLIES TO


 * Microsoft Visio for Enterprise Architects 2002

-





SYMPTOMS
When you build an Object Role Modeling (ORM) source model that contains a subtype object with the Create table inheritance option enabled, the database model may be generated incorrectly. In the database model diagram, the relationship between the subtype and supertype tables may be shown as a category relationship, instead of a table inheritance relationship. Also, the primary key may not be created for the subtype table.

When you perform an error check on the database model, you may receive error messages in the output window that are similar to the following:

Starting Logical Validation...

ORMTABLEINH.VSD : error C2118: 'EmployeeB' : Table/Entity has no primary identifier defined.

ORMTABLEINH.VSD : error L3001: 'EmployeeA_EmployeeB_FK1' : Parent column(s) not specified.

ORMTABLEINH.VSD : error L3002: 'EmployeeA_EmployeeB_FK1' : Child column(s) not specified.

ORMTABLEINH.VSD : error L3016: 'EmployeeA_EmployeeB_FK1' : Relationship must exist between a primary key or an alternate key designated as unique constraint.

ORMTABLEINH.VSD : error L3021: 'EmployeeA_EmployeeB_FK1' : Category relationship must be from the parent primary key to the child primary key, and both primary keys must be the same size.

Logical Validation complete - 5 error(s) 0 warning(s)



MORE INFORMATION
Do not enable the Create table inheritance option for a subtype object when you create an ORM source model for a relational database management system (RDBMS), such as Microsoft SQL Server. The Create table inheritance option is relevant only for creating models for databases that support Object Relational database features.

Create the ORM Source Model

 * 1) Start Microsoft Visio for Enterprise Architects.
 * 2) On the File menu, point to New, point to Database, and then click ORM Source Model to create a new ORM source model.
 * 3) In the Business Rules pane, click the Object Types tab.
 * 4) Add the following objects. Use the RefMode value that appears in parenthesis, if mentioned:
 * 5) * EmployeeA (RefMode: EmpNo)
 * 6) * EmployeeB
 * 7) Click the Fact Types tab.
 * 8) Press F2.
 * 9) In the Fact Editor dialog box, click the Fact tab.
 * 10) Add the following Unary facts, and then click OK:
 * 11) * EmployeeA works
 * 12) * EmployeeB earns
 * 13) In the Business Rules pane, click the Object Types tab, and then copy EmployeeA and EmployeeB objects to the drawing page.
 * 14) Drag a Subtype Relations connector from the ORM Source diagram stencil to the drawing page.
 * 15) On the drawing page, click the Subtype Relations connector, and then drag the end point (arrow pointer end) of the connector to the EmployeeA object shape. (The end point turns red. This indicates that the connector is glued to the shape. )
 * 16) Drag the begin point (arrowhead end) of the connector to the EmployeeB object shape. (The begin point turns red. This indicates that the connector is glued to the shape.)
 * 17) In the Object Types tab, click an EmployeeB object.
 * 18) In the Database Properties tab, click Subtype in the Categories list.
 * 19) Select the Map to separate table and the Create table inheritance check boxes.
 * 20) In the Primary Supertype list, select EmployeeA.
 * 21) Save the ORM source model.

Create the Database Modeling Project

 * 1) On the File menu, point to New, point to Database, and then click Database Model Diagram to create a new Database Modeling project.
 * 2) On the Database menu, point to Project, and then click Add Existing Document.
 * 3) Locate the ORM Source Model that is created in the Create the Source ORM Model section, and then click Open.
 * 4) Save the Database Model Diagram.
 * 5) On the Database menu, point to Project, and then click Build.

Add the Tables to the Drawing Page

 * 1) In the Tables and Views pane, press SHIFT and click both the EmployeeA and the EmployeeB tables, and then drag them to the drawing page. The shapes for the EmployeeA and the EmployeeB tables are created on the drawing page and are connected by a Category relationship connector. (The primary key is not created for the EmployeeB table.)
 * 2) On the Database menu, point to Model, and then click Error Check.
 * 3) Open the Output window to view the warning message that is described in the &quot;Symptoms&quot; section of this article.

