Book a Demo

Author Topic: Multiple foreign keyx  (Read 3644 times)

Rupert

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Multiple foreign keyx
« on: August 07, 2009, 08:35:02 pm »
I have a problem in data modelling with defining multiple foreign keys. There is a table A with three attributes (P (primary Key), Att1, Att2) another table B has two attributes (ID (primary Key), Name (varchar))
I define a foreign key constraint from A.att1 to B.ID which works fine. I see that constraint in the diagram as well as in the created DDL. After defining a second foreign key from A.Att2 to B.ID (with a different name), I see both associations in the diagram but none of them appears in the DDL.
It works, if I create an MS-Access database and import the tables. So it seems to be a problem of the editor-komponents.
Does anybody have an idea how to define multiple foreign keys like that in an ea-data model?

Thanks in advance,

Rupert

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Multiple foreign keyx
« Reply #1 on: August 08, 2009, 01:16:27 am »
Hi Rupert,

First, what version and build of EA are you using?

Second, you give data types for all attributes except the primary keys. Have you set data types for these attributes in your model?

Have you verified that the tables have a DBMS identified? Check the Database drop-down in the table properties dialog. I have noticed a disturbing tendency for EA to 'lose' the default DBMS setting after a version or build update. This may be related to issues with the metadata for SQL Server 2008 (previously reported) but I do not have time to test this.

David
No, you can't have it!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Multiple foreign keyx
« Reply #2 on: August 08, 2009, 01:24:05 am »
When I do this with SQL Server 2005 (that's just the one I picked) it works fine.

Try the suggestion regarding the DBMS setting of the tables. I've found that EA generates only limited DDL when it does not have a target DBMS. And EA does not complain (error or warning) when this happens.
No, you can't have it!

Rupert

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Multiple foreign keyx
« Reply #3 on: August 10, 2009, 05:57:57 pm »
Hello and thanks for the quick replies.

The program version is 7.1.828 (Build 828). The database for both tables is set to oracle.
The datatypes of the primary keys are LONG as are the datatypes of att1 and att2. So everything seems to be set correctly.

Rupert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Multiple foreign keyx
« Reply #4 on: August 10, 2009, 06:02:39 pm »
Quote
Hello and thanks for the quick replies.

The program version is 7.1.828 (Build 828). The database for both tables is set to oracle.
The datatypes of the primary keys are LONG as are the datatypes of att1 and att2. So everything seems to be set correctly.

Rupert
There were definitely problems with foreign keys a while back.  Download a trial copy of the latest EA and confirm the problem still exists.  828 is pretty ancient now...

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Rupert

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Multiple foreign keyx
« Reply #5 on: August 10, 2009, 08:19:02 pm »
This seems to be the solution. It works with the new versiion. There are still some things I don't understand concerning the constraint's names but I think I can figure that out.

Thanks for the help.

Regards
Rupert

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Multiple foreign keyx
« Reply #6 on: August 10, 2009, 08:47:14 pm »
There is a dialog where you can set (some of) the components of how EA creates constraint names. You can reach it from the main menu via Tools | Options | Source Code Engineering | Code Editors. Use the browse (...) button labeled DDL Name Templates.

Note that you must have a model open to open the DDL Name Template dialog. Unfortunately the browse button does not display as disabled if no model is open, but nothing happens when you click the button.

HTH, David

Bug reported.
« Last Edit: August 10, 2009, 08:53:41 pm by Midnight »
No, you can't have it!