Book a Demo

Author Topic: MDA Transf. -> DDL - wrong primary keys generat  (Read 3161 times)

pocketom

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
MDA Transf. -> DDL - wrong primary keys generat
« on: March 26, 2010, 01:44:49 am »
When I do a MDA transformation PIM->PSM(DDL) (or also PSM(C#) -> PSM(DDL)), it doesn't make use of my already existing key variables ( I marked them with stereotype "id" in the PIM model, see screenshot), it creates new ID columns and sets it as PK. Unfortunately I need to break up also the FK relations and all that takes longer than creating it directly from scratch...



Of course I already took a look into the Transformation Template for DDL/Connector, but with my beginners level this is clearly to heavy. Unfortunately my boss wants to see this work now, to decide if all our developers can work with EA... For me it's clear that it can be customized, but I don't have enough experience to do it right now.  :-[

So if anybody could help how to define what becomes a PK in the transformed DDL I would be very happy!

« Last Edit: March 26, 2010, 01:46:21 am by pocketom »

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: MDA Transf. -> DDL - wrong primary keys gen
« Reply #1 on: March 28, 2010, 10:14:10 am »
Not sure what you are trying to achieve but it looks like you may a problem with your thoughts on what is a platform independent model (PIM). Generally you don't worry about implementation details such as gUID's as this is platform specific. So from your example you would delete the gUID attribute from the elements on the left. If you really need a primary key called gUID then modify the DDL transform to change the primary and foreign keys. You will need to modify the scripts under DDL.Class, DDL.Connector and DDL.ForeignKey.

For example in the DDL.Class script you would change the attribute "name" in script below
...
  PrimaryKey
  {
    Column
    {
     name=%qt%%CONVERT_NAME(className, "Pascal Case","Camel Case")%ID%qt%
      type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
    }
  }
...

To something like this
     name=%qt%gUID%qt%

You'll also need to modify those other scripts DDL.Connector and DDL.ForeignKey in a similar fashion.

Well I hope that helps.
« Last Edit: March 28, 2010, 10:40:39 am by phenzell »
Happy to help
:)

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: MDA Transf. -> DDL - wrong primary keys genera
« Reply #2 on: March 28, 2010, 10:37:41 am »
With regards to the example diagram provided, you do realize that the way the elements on the left have been modelled with inheritance means that the EcomLogin class will end up with three gUID attributes. Its own, the one it inherited from Identity class and the one it inherited from ExchangeableBusinessObject.  
Thought I'd just point that out in case it hadn't occurred to you.
Happy to help
:)

pocketom

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: MDA Transf. -> DDL - wrong primary keys genera
« Reply #3 on: April 06, 2010, 11:42:53 pm »
Thanx for your hints, I've managed it. I modified the DDL templates you mentioned to realize a table-per-subclass inheritance strategy for NHibernate. To make it easier I decided to let EA create the ID columns, the only thing I needed to do is to rename my gUID field in my PIM to 'exchangeableBusinessObjectID", then the PK/FK relationships that EA generates match with the predefined ID field by naming convention. I don't use the stereotype 'id' anymore...