I don't want Autogenerated Primary Keys in DDL

Discussions about database modeling product Cameo Data Modeler functionalities

Moderator: Moderators

I don't want Autogenerated Primary Keys in DDL

Postby bgoldfeder1 » Thu Jan 06, 2011 6:02 pm

I am attempting to Transform a database design I have created as an ERD in UML. When I perform the transformation from UML to Generic DDL, there is no option to use the natural Primary Keys defined in my entities, I am forced to have autogenerated synthetic PKs with an integer. Is there any way to turn off this behavior and use the defined Primary Keys?

My end result is that I want to have the DDL for a PostgreSQL database. Should I just create it as a DDL physical model? Also, what are the ominous warnings in the manual about using the FK stereotype?

Thanks.

Bruce G.
bgoldfeder1
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:0
Joined: Thu Jan 06, 2011 5:58 pm

Re: I don't want Autogenerated Primary Keys in DDL

Postby TomasJkn » Tue Jan 11, 2011 2:27 am

Hello Bruce,
I am attempting to Transform a database design I have created as an ERD in UML. When I perform the transformation from UML to Generic DDL, there is no option to use the natural Primary Keys defined in my entities, I am forced to have autogenerated synthetic PKs with an integer. Is there any way to turn off this behavior and use the defined Primary Keys?

Something is not right here.... ER to DDL transformation does (or at least should) use the primary keys, defined in your entities. It only generates synthetic PKs if entity does not have any PK defined.

Two things to check:
  • which transformation do you use to transform your ER models to DDL? Do you use ER to Generic DDL transformation (proper way to do it) or maybe you are trying to use UML to Generic DDL transformation (not recommended in this case)?
  • How do you define your natural PKs in the ER model? If you see your PK columns in the PK compartment of the entity on the diagram, then everything is OK.
If these 2 things are addressed, then everything should be OK. See the attached example.
There I have a basic ER model with a couple of entities with natural keys. After transforming (ER to Generic DDL) I have two tables with proper PKs and FK; no autogenerated PKs anywhere.

My end result is that I want to have the DDL for a PostgreSQL database. Should I just create it as a DDL physical model?

Yes, you can jump straight into the physical model (DDL). Making ER is not necessary in any way (in fact ER modeling has appeared rather recently in MagicDraw, while DDL modeling is an old, old feature).

Also, what are the ominous warnings in the manual about using the FK stereotype?

I am not sure which manual place we are talking about here, but if it is the place in the Cameo DataModelerPlugin UserGuide.pdf (the one starting with "Note about foreign key modeling:"), then I can give comment on that.

Indicating foreign keys on ER models is not very right from theoretical standpoint. Theoretically, foreign keys are deemed to be a platform-specific (of Relational, SQL databases) implementation of relationships between entities and should not be specified in platform-independent ER data models (other platforms, such as object DBs or the in-vogue NoSQL solutions may not need any FKs at all and implement relationships in some other way).

So there is a bit of controversy, whether FKs should be available in ER modeling or not (they are somewhat convenient from practical standpoint). Some tools/notations/methodologies do allow FKs in ER, while others do not. MagicDraw currently does not support or encourage FK usage in ER models. But we do not preclude marking attributes as FK by the user himself - if he wants to/deems it necessary.


Please note that this comment applies only to logical data modeling (ER). FKs in the physical DB model (DDL) are of course normal/industry-standard way to implement relationships in the relational databases and they can be used without reservations in MagicDraw.
Tomas Juknevicius
Senior Systems Analyst
No Magic Europe
TomasJkn
Customer Support
Customer Support
 
Posts: 63
Posts Rating:6
Joined: Mon May 10, 2010 9:24 am

Re: I don't want Autogenerated Primary Keys in DDL

Postby TomasJkn » Tue Jan 11, 2011 2:29 am

attaching example
You do not have the required permissions to view the files attached to this post.
Tomas Juknevicius
Senior Systems Analyst
No Magic Europe
TomasJkn
Customer Support
Customer Support
 
Posts: 63
Posts Rating:6
Joined: Mon May 10, 2010 9:24 am


Return to Cameo Data Modeler

Who is online

Users browsing this forum: No registered users and 0 guests