You have A, B and C pointing to D: Ergo, D has an implicit many-to-one
to A, B and C, which is hidden in AR due to the unidirectional
relation. Now you want that D only has one many-to-one connection,
which will direct to A, B or C. This seems impossible: How should AR
know from an integer to which of the classes A, B or C it belongs? If
you use Identity, the same key might be used in A, B and C, leaving AR
clueless of what to load.

You need three FK columns in D if A, B and C are not related. If they
belong to the same base class, you can define the HasMany there, but
with unrelated classes your scenario is impossible.

-Markus

2009/5/27 Hexedit <[email protected]>:
>
> I have three unique entity classes that each have a collection of a
> fourth entity via the HasMany attribute. The mappings should be one-to-
> many unidirectional relationships from entities A, B, and C to entity
> D. Each HasMany attribute references the same table and the same
> column for the foreign key. Since the referenced column is an integer
> it should not matter that it could be pointing to objects from 3
> tables. The problem is that the generation tool non-deterministically
> picks one of the first three entities and creates a foreign key
> relationship from the reference column in the 4th entity table to the
> entity that owns that relation. Is there any way for me to override
> this behavior and make it so that the Many side of the HasMany
> relationship doesn't foreign key back to the first table?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to