Visual Paradigm Logo
     Build Quality Applications Faster, Better and Cheaper
 
Home | Products | Download | Documentation | Support | Resources | Partners | Quick Tour | Shop | Company |  
 
   Visual Paradigm Discussion Forum
  Login   [ Register ] Email: Password: Log me on automatically I lost my password  
Recent Topics
Advanced Search
Generalisations and ORM  
Forum Index -> Object Relational Mapping (ORM)
Author Message
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Jick

I have a weird problem. Given the following class diagram which generates the following XSD why does the ORM decide to stick all the attributes into the superclass?

If I reverse the generalization then it generates the correct ERD but then the XSD is reversed.

Any thoughts?

Thanks in advance

Toby

Attached Image : No description given (13 kb)

Attached Image : No description given (14 kb)

Attached Image : No description given (4 kb)

 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hello Toby,

Please try:
1. Right-click on the Super class
2. Select Open Specification from the popup menu
3. Select ORM Class Detail
4. Press on Subclasses...
5. Select the SubClasses from the Inheritance Strategy dialog box
6. Set the strategy to be "Table per class hierarchy"
7. Press Apply
8. Confirm
9. Right-click on the diagram and select "Synchronize to Entity Relationship Diagram" from the popup menu

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Hi Jick,

I tried that (both options) and no joy. I have had it work on other projects but it seems to occur for some classes and not others randomly.

I have created a new project with three classes and tried it and I still get a single class or three separate classes...


Attached is the vpp file..

untitled.vpp
 Description Download
 Filesize 18 kb
 Downloaded:  114 time(s)

 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hi TobyAnscombe,

I have captured a movie to show you how to do this. Please watch at:
http://files3.visual-paradigm.com/200707/Jick/generalization-hierarchy.html

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Hi Jick - just downloading the newer version for my other problem...

This one may be my understanding that is at fault...

In the above diagram, class A could (and should) be an interface; it should never be implemented as a physical class. My expectation would be that via generalization the two attributes would propagate to the subclasses.

A real-life example: I am modelling a number of lookup tables (eye colour, hair colour etc). Each lookup table has four attributes: ID (int), Text(varchar(255), Effective From(date) and Effective To (date). I would like to have a superclass which has the repeatable attributes and in the subclass only have the relevant attributes.

The class & ERD diagrams should look like below.

I have managed to achieve the desired result but it seems not to work now.

Any ideas?

Attached Image : Description : Class (12 kb)

Attached Image : Description : ERD (19 kb)

 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hi Toby,

Thank you for your explanation. I have passed your request onto our team for further feasibility studies. Once there is a feedback, I will get back to you.

Have a nice weekend!

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hi Toby,

I am sorry to say that we do not support this kind of mapping strategy at this moment.

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Thanks Jick - oddly enough, it works when there is only one class in the chain but in reverse!

What I find a bit weird (may be a bug) is that when you generate an ERD from the diagram you end up with the superclass being generated not the subclass which is the exact opposite to what would be expected.

Take a look at the following diagrams:

The first is a basic two class model with generalisation.

The second is what happens when you InstantReverse to a XSD

The third is what happens when you sync to ERD.

The first two do what I would expect, the ERD looks to be the inverse of what is expected; the super and sub classes have reversed.

Attached Image : Description : Schema (4 kb)

Attached Image : Description : Class (8 kb)

Attached Image : Description : ERD (11 kb)

 
 
   Forum Index -> Object Relational Mapping (ORM)
Go to:   
Powered by JForum 2.1.4 © 2005 - Rafael Steil