Toad World® Forums

Confused by logical Relationships not mapping to PK/FK in physical model


#1

I created a Parent logical entity with a single attribute, which is its Unique Identifier.
Then I added a “empty” Child entity, and then added an identifying relationship to Parent.
At this point I expected the Unique Identifier of Parent to be “copied” to Child, but it wasn’t.

Thinking the attribute would be added when converted to the physical model (Oracle 11g), I tried a simple conversion, but the attribute wasn’t added there either.

If I add an equivalent relationship in the physical model, then the parent PK is automatically added to the Child table.

So how is one supposed to model the equivalent of a PK/FK relationship in the logical model such that it properly generates the PK/FK once converted to the physical model?

I’d appreciate any insights on this matter, as I’m currently stumped. I can’t imagine there isn’t some way to do this automatically, because otherwise it would reduce the logical modeling usefulness in my mind. Or am I completely missing something?

Thanks, --DD

Update: After watching the flash movie on Logical Modeling 1 again, I tried again, this time making sure I create the PUIs before adding the relationships, and also naming the PUIs differently in each entity. Then the PFK where indeed added to the physical child tables. So I guess it was user error (what I suspected :), yet it’s a bit confusing that creation order may matter.

Message was edited by: ddevienne


#2

If you were pointing relation from child entity to parent entity (where is your attribute in PK),than you can’t have key migrated after conversion :wink:

You must point relation from parent to child,than everything is ok.

Tomas
QA


#3

Hello,

I created a Parent logical entity with a single attribute, which is its Unique Identifier.
Then I added a “empty” Child entity, and then added an identifying relationship to Parent.

Please add the relationship from parent to child as Tomas wrote.

At this point I expected the Unique Identifier of Parent to be “copied” to Child, but it wasn’t.

Yes, it is a correct behaviour. In LER model, keys are not transferred with relationships. (Unique identifier is not “copied” to child table in LER model.)

Thinking the attribute would be added when converted to the physical model (Oracle 11g), I tried a simple conversion, but the attribute wasn’t added there either.

After you convert your LER model to PER model, a foreign key should be created in the PER model automatically.

Update: After watching the flash movie on Logical Modeling 1 again, I tried again, this time making sure I create the PUIs before adding the relationships, and also naming the PUIs differently in each entity. Then the PFK where indeed added to the physical child tables. So I guess it was user error (what I suspected :), yet it’s a bit confusing that creation order may matter.

The order does not matter. You can create a relationship in your LER model and then add the PUI. After you convert your LER model to PER model, the foreign key should be created in PER model automatically.

I’ve just checked it out in current Beta 3.2.3.10 and upcoming full version 3.2.4 and it works fine for me. What TDM version do you use?

Thanks.

Regards,

Vladka

Message was edited by: vladka