Book a Demo

Author Topic: DDL generation  (Read 5442 times)

Matt

  • EA User
  • **
  • Posts: 96
  • Karma: +0/-0
    • View Profile
    • Solutions Reality
DDL generation
« on: November 13, 2002, 03:20:55 am »
Sorry if this has been covered before, but couldn't see it on a cursory check.....

We are currently using EA to build our database model and other than a few glitches that I need to check into further it works pretty well.

HOWEVER, one thing that is really annoying - I need to check if this is a bug or something I am doing wrong....

If I have 2 tables and I link them correctly with foreign keys etc everything works fine (now I have worked out how to do it properly  :D  ).  But, if I need to change the name of the key for some reason then everything stops working.  This took some time to work out what was wrong.  Should the key not update on the association automatically - or would that be incorrect UML?

Now that I know to look out for it, it is not as bad - but caused a nightmare when someone had changed the name of 20 FK's in the diagram without updating the associations.....

Thanks for any input,

Matt

Tony

  • Guest
Re: DDL generation
« Reply #1 on: November 14, 2002, 07:10:17 am »
Matt,

You mention you worked out how to define a foreign key properly. How did you get this to work? The help text does not provide a complete description of this task. Nowhere is there any mention of where to specify the table to which the foreign key points.

Can anyone tell me how to specify the table and primary key to which the foreign key is pointing?

Thanks,
Tony

CJ

  • EA User
  • **
  • Posts: 288
  • Karma: +0/-0
    • View Profile
Re: DDL generation
« Reply #2 on: November 14, 2002, 07:21:02 am »
G'day Tony,

In the help contents (EA v3.5), under the "Using UML" section, and under "Data Modeling", you should be able to find everything you need.

Can you point out which steps aren't clear?
Cheers and best regards.

Tony

  • Guest
Re: DDL generation
« Reply #3 on: November 14, 2002, 07:41:32 am »
Matt,

The help is missing the explanation of how to connect the foreign key just created to the primary key of the other table.

Here is the help text for foreign keys:


To create a foreign key  
1.  Locate the required table in either a diagram or in the project browser  
2.  Use the context menu to open the Operations dialog  
3.  Add an operation (such as "FK_CustomerID" - the FK_ prefix is optional but helps identify the operation)  
4.  Set the stereotype for the Operation to "FK"  
5.  Select the operation and go to the Column tab:  
 
Add the required columns in the desired order then press Save to save changes
You have created a Foreign Key. The example below shows how this will look in a diagram    
 

Only problem is that no association shows up between the tables as pictured in the diagram. I finally figured how to use the association relationship to make the connection:

Missing #6
Add an association between the tables on your data model diagram.
Missing #7
Update association properties for tabs "Source Role" and "Target Role" to include the foreign key and primary keys as appropriate
 
   

 
 

CJ

  • EA User
  • **
  • Posts: 288
  • Karma: +0/-0
    • View Profile
Re: DDL generation
« Reply #4 on: November 14, 2002, 07:49:45 am »
G'day Tony,

I've copied the following from the Data Modeling section, the "Link Tables" help:

Tables may be linked using association relationships.  
To link tables  
·  Select an association relationship in the Object Toolbar  
·  Click on one table and draw a connector line to the target  
·  Double click on the new link to bring up the link specification dialog  
·  Set the details for each end of the link in the Source and Destination roles. Set the name of the role to a PK or FK index/operation.  
·  Set the cardinality for each role  


Hope that helps,

Jason
Cheers and best regards.

Tony

  • Guest
Re: DDL generation
« Reply #5 on: November 14, 2002, 08:27:42 am »
Matt,

That's it! Would be nice though if this was cross-referenced with the foreign key help text. Thanks.

Love the product!

Regards,

Tony

Matt

  • EA User
  • **
  • Posts: 96
  • Karma: +0/-0
    • View Profile
    • Solutions Reality
Re: DDL generation
« Reply #6 on: November 14, 2002, 08:31:04 am »
Tony,
thanks for the credit, but it was Jason that answered your questions!
;D

Tony

  • Guest
Re: DDL generation
« Reply #7 on: November 14, 2002, 09:23:58 am »
Oops!

:-[

Thanks Jason!

Tony

  • Guest
Re: DDL generation
« Reply #8 on: November 15, 2002, 02:21:36 pm »
Matt (not Jason this time!),

Now that I got my links working I've encountered the same problem as you did: renaming the foreign key breaks the association between tables and causes the foreign key link to not show up when generating DDL. I had to edit the association properties to set it to use the new foreign key names to get things working again.

Would be nice if the association continued to use the same FKs with the new names.