Foreign keys to alternate keys

D

Dave Routledge

Hi

I am trying to use ORM to model a foreign key to an alternate key.
Visio seems to assume I always want to link to the primary key of the
remote table.

If I add the relationship in the database model (DM) this doesn't seem
to have any impact on the ORM when I update from the DM. However, if I
then generate a new DM from the updated ORM, the correct reference is
generated! So where is it storing this fact in the ORM?
Any suggestions anyone?

Many thanks

Dave
 
S

Scot Becker

I am trying to use ORM to model a foreign key to an alternate key.
Visio seems to assume I always want to link to the primary key of the
remote table.

If I add the relationship in the database model (DM) this doesn't seem
to have any impact on the ORM when I update from the DM. However, if I
then generate a new DM from the updated ORM, the correct reference is
generated! So where is it storing this fact in the ORM?
Any suggestions anyone?

Strictly speaking, it's not storing it in the "ORM" but rather it has some
mapping instructions encoded somewhere internally.

ORM doesn't support any mapping instructions to migrate an alternate key to
a child table, it will always use the primary key which it infers from
either the internal reference mode (e.g. Object(id)) or from one of more
facts that make up the reference mode (e.g. Object has ID()).

Hope that helps,
Scot.
................................................
Scot Becker

Orthogonal Software
www.orthogonalsoftware.com

ORM Blog: www.objectrolemodeling.com

To e-mail me, please use my first name at the domain listed above. All mail
sent to the reply-to address gets routed to a junk e-mail folder where it
will likely be deleted without being read.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top