Generalisations and ORM

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
Class Diagram1.jpg
Entity Relationship Diagram1.jpg
pic.png

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

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

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

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?
Class Diagram1.jpg
Entity Relationship Diagram1.jpg

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

Hi Toby,

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

Best regards,
Jick

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.
XSD.png
Class Diagram1.jpg
Entity Relationship Diagram1.jpg