21.07.2013 Views

Chapter 18 - Data Model - Visual Paradigm

Chapter 18 - Data Model - Visual Paradigm

Chapter 18 - Data Model - Visual Paradigm

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SDE-VS User’s Guide (Part 2, for ORM) <strong>Chapter</strong> <strong>18</strong> –<strong>Data</strong> <strong>Model</strong><br />

<strong>18</strong>-20<br />

Example:<br />

Figure <strong>18</strong>.49 - Copy Statement for create constraint<br />

Create Constraint :<br />

alter table `OrderLine` add index `FK_OrderLine_1969` (`PurchaseOrderPO_NO`), add<br />

constraint `FK_OrderLine_1969` foreign key (`PurchaseOrderPO_NO`) references<br />

`PurchaseOrder` (`PO_NO`);<br />

Drop Constraint :<br />

alter table `OrderLine` drop foreign key `FK_OrderLine_1969`;<br />

Mapping a <strong>Data</strong> <strong>Model</strong> to an Object <strong>Model</strong><br />

Object Relational Mapping (ORM) is supported which maps data models to object models and vice versa.<br />

Mapping between objects to relational database preserves not only the data, but also the state, foreign/primary key mapping,<br />

difference in data type and business logic. Thus, you are not required to handle those tedious tasks during software<br />

development.<br />

Mapping Entities to Classes<br />

All entities map one-to-one to persistent classes in an object model.<br />

Example:<br />

Figure <strong>18</strong>.50 - Mapping entities to classes<br />

In the above example, the Customer Entity map one-to-one the Customer Class as the Customer instance can store the<br />

customer information from the Customer Entity.<br />

Mapping Columns to Attributes<br />

Since all entities map one-to-one to persistent classes in an object model, columns in turn map to attributes in a one-to-one<br />

mapping. All specialty columns such as computed columns and foreign key columns are ignored during the transformation.<br />

Example:<br />

Figure <strong>18</strong>.51 - Mapping columns to attributes<br />

In the above example, the following table shows the mapping between the columns of the Customer Entity and the attributes of<br />

the Customer Class.<br />

Customer Entity Customer Class

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!