Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: ScorpioTiger on May 06, 2010, 02:30:44 am

Title: Creating multiple foreign key associations
Post by: ScorpioTiger on May 06, 2010, 02:30:44 am
Hi folks,

I'm still fumbling my way around EA and enjoying the journey.

Today I found myself trying to create two associations between two entities for a data modelling project. Basically, I have a primary key of [pk_contact] in one table, and two foreign keys [fk_primary_contact], and [fk_secondary_contact] that both relate to [pk_contact]. For the life of me I can't figure this out. If I try to add a second association, EA just highlights the first association. The foreign keys dialogue box doesn't give me the option to create more than one association.

I'm sure the answer is simple....help....!! (and thanks in advance)
Title: Re: Creating multiple foreign key associations
Post by: Paolo F Cantoni on May 06, 2010, 05:21:44 am
Firstly, which version of EA are you using, in what environment?

[edit]Well, I haven't used the data modelling portion of EA for a few months.

But I knew you CAN create multiple associations between tables.

In quickly refreshing my understanding I've found 4 bugs (quite serious) in 3 minutes.  2 I think I reported years ago, and 2 (the really bad ones) are brand new!

Can someone else have a look and report them?  I think I've done my bit for the user community for a while...

I'm glad Sparx is proud to announce new releases, because if I produced software of this quality ::), I wouldn't be.

See also: How To Create Table Relationships in a Schema (http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1272420170/8#8) for CoffeeAddict's view on the subject[/edit]

Paolo
      
[size=9]Using EA in spite of EA, NOT because of it!TM[/size]
Title: Re: Creating multiple foreign key associations
Post by: ScorpioTiger on May 06, 2010, 06:52:43 pm
Quote
Firstly, which version of EA are you using, in what environment?

I'm using 7.5.848 Corporate Edition on Windows 7.


Ok. Seems I've come unstuck by by an assumption...the assumption that when EA creates a second association that it doesn't place the connector precisely over the first, and thus appearing to the user that it has done nothing. Turns out I had a half dozen of my attempts one on top of the other and appearing as a single connector. And of course selecting this apparently single connector always selects the uppermost, so you don't get any hints from differing properties in the dialogue.

Whilst correcting this I did find something that would appear to be a bug. I had a foreign key defined for my first association which had two foreign keys relating to a single target primary key...certainly not right, so I selected the appropriate attributes and hit 'Save', only to find it didn't update it at all. I had to delete the association and start again. Pretty poor.
Title: Re: Creating multiple foreign key associations
Post by: Paolo F Cantoni on May 06, 2010, 10:29:13 pm
So you're good to go?

Paolo
Title: Re: Creating multiple foreign key associations
Post by: ScorpioTiger on May 06, 2010, 10:34:13 pm
Quote
So you're good to go?

Paolo

Yes, good to go...thanks.
Title: Re: Creating multiple foreign key associations
Post by: ScorpioTiger on May 10, 2010, 05:36:02 pm
Arrhh..!! Just when I thought it was safe to go back in the water.

I can now create multiple associations for my foreign keys. Now when I go and change one association, it changes all of them...! I went through and one by one and defined my foreign keys, and then thought I'd go through them again and just make sure it was right only to find the first one looked just like the last one...and they're all the same..!

How can EA have this bug? This makes the product unusable.
Title: Re: Creating multiple foreign key associations
Post by: Paolo F Cantoni on May 10, 2010, 07:07:00 pm
OK... If you want, I'll have a look (later).  I'm pretty sure it used to work OK...

But it will cost you...  You'll have to go through the dialog and log every UI bug you find...  ::)

Paolo
Title: Re: Creating multiple foreign key associations
Post by: son-of-sargasso on May 10, 2010, 10:19:06 pm
Quote
But it will cost you...  You'll have to go through the dialog and log every UI bug you find..

SADIST! You know that's a lifetime's work.  Couldn't he just notice them and enjoy them as much as you do!

hehehehe
Bruce   ooops
bruce







(it was obviously a UI bug!)  :-X

Seriously though, I just went and tried this and it didn't happen.  So I tried it again and noticed that I have had a habit of moving the first FK relationship as soon as it was created.  Strange how you can get into so much of a habit around here that you don't even notice the bug/workaround anymore!  Dog, knows how many more of these there are ?   :o
Title: Re: Creating multiple foreign key associations
Post by: ScorpioTiger on May 12, 2010, 08:24:18 pm
Ok, I've $%&*'ed around and $%&*'ed around and just can't get it to work. I've tried moving them after creation. I've tried creating multiple association before setting the foreign key attributes. Nothing works.

How is it that you are all creating multiple foreign key constraints? Is there a work around or is it that nobody is really using this product for anything serious?

Somebody please enlighten me...!
Title: Re: Creating multiple foreign key associations
Post by: Paolo F Cantoni on May 12, 2010, 09:19:56 pm
Quote
Ok, I've $%&*'ed around and $%&*'ed around and just can't get it to work. I've tried moving them after creation. I've tried creating multiple association before setting the foreign key attributes. Nothing works.

How is it that you are all creating multiple foreign key constraints? Is there a work around or is it that nobody is really using this product for anything serious?

Somebody please enlighten me...!
I can only re-iterate that I am able to create two different Associations with two different child columns (to the same parent key column - in this case the PK) - EAUI not withstanding... (build 856)

Did you ensure you used DIFFERENT FK constraint names - when you created the FKs?

Paolo
Title: Re: Creating multiple foreign key associations
Post by: Geert Bellekens on May 12, 2010, 09:27:22 pm
Quote
How is it that you are all creating multiple foreign key constraints? Is there a work around or is it that nobody is really using this product for anything serious?

We are using EA for something serious: UML modelling, but not for database modelling, so I can't help you out here.

Geert
Title: Re: Creating multiple foreign key associations
Post by: ScorpioTiger on May 12, 2010, 11:48:26 pm
Quote
Did you ensure you used DIFFERENT FK constraint names - when you created the FKs?

Paolo

Yes. I tried using different names. I even had a strange situation where I deleted all associations between the two entities concerned and created a new one only to have EA tell me that a constraint with that name already existed..!

I'll try a few more things, but at some point I'm going to have to give up and go to a different tool.

Thanks for the feedback.

Title: Re: Creating multiple foreign key associations
Post by: Geert Bellekens on May 12, 2010, 11:57:06 pm
Ah, are you sure you are deleting the relations? or just removing them from the diagram.
Use Ctrl-Del to "really" delete a relation.

Geert
Title: Re: Creating multiple foreign key associations
Post by: Paolo F Cantoni on May 13, 2010, 12:26:07 am
Quote
Ah, are you sure you are deleting the relations? or just removing them from the diagram.
Use Ctrl-Del to "really" delete a relation.

Geert
To make sure you've got them ALL; use Visible Relations [Ctrl+Shift+I] to make them all visible first...

Paolo
Title: Re: Creating multiple foreign key associations
Post by: ScorpioTiger on May 13, 2010, 06:33:01 am
Quote
Ah, are you sure you are deleting the relations? or just removing them from the diagram.
Use Ctrl-Del to "really" delete a relation.

Geert

Definately deleting them. I haven't changed any default settings for warning dialogues, so when I hit delete, I get prompted to delete or hide the association...I've been selecting delete.

I'll try again tommorow, but I really can't afford to be wasting too much time on it. I might have to take what DDL it generates and reverse engineer it into another modeling tool.

I can't believe that others have not had the same issue.
Title: Re: Creating multiple foreign key associations
Post by: skiwi on May 13, 2010, 07:59:33 am
I have had a lot of problem in this area when doing some physical data modelling. In particular with multiple foreign keys.

See also
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1263179990
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1263306644
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1260782579
Title: Re: Creating multiple foreign key associations
Post by: ScorpioTiger on May 13, 2010, 09:24:42 pm
Hi Folks,

Ok, I've done some more playing. I've just been able to successfully add two foreign key constraints. The secret was in ensuring that you don't accept the default name for the constraint. If you create one constraint and leave the default name, as soon as you create a second constraint, the name will be the same as the first one and they're treated as one and the same because they have the same name...and changing the name at that point doesn't help...changing the attributes used for the constraint on one changes the constraint on both.

There also seems to be an artifact left after you delete an association from the model. This prevents you from creating a constraint, deleting it, and then creating a constraint with the same name as the one you've just deleted.

Pretty crappy bugs..! And they shouldn't be difficult to fix.

Thanks for everyones input and I hope my experience helps in defining a work around.

Scorpio...

Title: Re: Creating multiple foreign key associations
Post by: skiwi on May 14, 2010, 06:44:50 am
Good work. I hope you have formally reported the bugs, and we see them fixed.
Title: Re: Creating multiple foreign key associations
Post by: Paolo F Cantoni on May 14, 2010, 10:24:31 am
Quote
[size=18]...[/size]
Pretty crappy bugs..! And they shouldn't be difficult to fix.
[size=18]...[/size]
That's what I thought 6 years ago for some of the bugs I reported then...

They're STILL here!

Please submit Registered Bug Reports (http://www.sparxsystems.com/registered/reg_bug_report.html) or Bug Reports (http://www.sparxsystems.com/support/bug_report.html) and tell us the names,
leaving a note here to say you've done it.
We users can then vote for them using a Registered Bug Report (http://www.sparxsystems.com/registered/reg_bug_report.html) or Bug Report (http://www.sparxsystems.com/support/bug_report.html) with the same name[/color]
Paolo
Title: Re: Creating multiple foreign key associations
Post by: ScorpioTiger on May 20, 2010, 12:56:05 am
Quote
Good work. I hope you have formally reported the bugs, and we see them fixed.

Done.