O/R Mapping
Mac OS X
Tips and Tricks
UML Diagrams
VP Suite
Change Log

Using ORM Resources of Resource-Centric Interface

VP’s Products provide the resource-centric interface which enables the easy creation of diagrams by using the valid editing resources listed around the diagram elements.

To enhance the flexibility in creating a class diagram with the persistent objects, an ORM-Persistable class can be easily created and its valid editing resources are provided.

Creating an ORM-Persistable Class

To create an ORM-Persistable class, simply perform the following steps:

  1. Create a class diagram by using the New Class Diagram toolbar icon.

    A class diagram is created with a default package.

  2. Double-click the <default package> located on the top-left corner of the diagram, enter a package name for the classes to be created.

  3. On the diagram toolbar, click the Class shape icon and hold for a while, a pop-up menu shows.

  4. Select ORM-Persistable Class from the pop-up menu.

  5. Click on the diagram, a class stereotyped with «ORM Persistable» is created on the diagram, enter the name for the ORM-Persistable Class.

Using ORM Resources

Using the ORM-related resources listed around the ORM-Persistable class, you can create a class diagram with persistent objects easily.

The following table shows the available ORM Resources of the ORM-Persistable class:

ORM Resource Description
using_orm_resources-7.jpgCreating an ORM Implementation Class.
using_orm_resources-8.jpgCreating an ORM-Persistable class with a one-to-one directional association.
using_orm_resources-9.jpgCreating an ORM-Persistable class with a one-to-one bi-directional association.
using_orm_resources-10.jpgCreating an ORM-Persistable class with a one-to-many directional association.
using_orm_resources-11.jpgCreating an ORM-Persistable class with a ont-to-many bi-directional association.
using_orm_resources-12.jpgCreating an ORM-Persistable class with a many-to-many directional association.
using_orm_resources-13.jpgCreating an ORM-Persistable class with a many-to-many bi-directional association.

Creating One-to-One Association

Let’s assume a Staff ORM-Persistable class has been created as shown below.

Each staff should have a staff profile. A profile class can be created by the ORM resource. To create the Profile class:

  1. Mouse over the Staff class, click One-to-One Association → Class resource.

  2. Drag the resource to anywhere of the diagram.

    Note: By dragging the resource to the diagram, you can add an ORM-Persistable class where you want.

    An ORM-Persistable class is created and a one-to-one association is created between the Staff class and the newly created class.

  3. Enter Profile as the name of the newly created class.

    The one-to-one association between the Staff and Profile classes is created.

Creating One-to-Many Bi-directional Association

Let’s take the example to create a one-to-many bi-directional association Let’s assume a PurchaseOrder ORM-Persistable class has been created as shown below.

Each purchase order may contain many orderline. To create a one-to-many bi-directional association between purchase order and orderline:

  1. Mouse over the PurchaseOrder class, drage the One-to-Many Bi-directional Association → Class resource to the diagram.

  2. A one-to-many association is created with a newly created ORM-Persistable class. Enter Order to the name of the newly created class. The one-to-many bi-directional association is created successfully.

Creating ORM Implementation Class

An ORM implementation class is used to add extra logic to the persistent object to manipulate the persistent data. Let’s take the following class diagram as example, an ORM Implementation class for the PurchaseOrder can be created to calculate the total amount of the purchase order.

To create the ORM Implementation class, perform the following steps:

  1. Right-click on the PurchaseOrder class, select Add > Operation from the pop-up menu to add an operatiion to the PurchaseOrder class.

  2. Enter calculateTotalAmt():double to the name of operation.

  3. Mouse over the PurchaseOrder class, click Create ORM Implementation Class resource.

    An ORM implementation class is created automatically.

Related Articles


Last modified: 2006/03/21 13:37
Home | Recent Topics | Highlights | UML Diagrams | Tips and Tricks | Object-Relational Mapping
visual-paradigm.com Home | Training Center | UML Center | VP Gallery | Discussion Forum | UML Open Directory