2

I would like to know if I can use the same inverse relationship twice for 2 different relationships?

Here is an example :

Trip

  • Origin (to-one relationship) MapPoint (inverse ReferencedBy)

  • Destination (to-one relationship) MapPoint (inverse ReferencedBy)

MapPoint

  • ReferencedBy (to-many relationship) Trip (here is the problem, how to set the inverse ?)
Sam Holder
  • 32,535
  • 13
  • 101
  • 181
Clement M
  • 709
  • 6
  • 14

1 Answers1

0

No you can't or shouldn't. I tried and it causes mayhem.

So that MapPoint should have 2 relationship.

ReferencedByOrigin ReferencedByDestination

It may look strange at first. But think about it. There is nothing wrong with this approach.

Another approach is to have a one to many relationship from MapPoint to Origin and Destination and put an enum.

This approach is more elegant but actually far more complicated.

Another approach is to have 2 subEntities of Origin and Destination.

This one is more elegant but still you will need

ReferencedByOrigin
ReferencedByDestination

in the MapPoint.

Anonymous White
  • 2,149
  • 3
  • 20
  • 27
  • It raises the warning: http://stackoverflow.com/questions/38258510/the-inverse-relationship-for-does-not-reciprocate-an-inverse-relationship How can I fix it? – Dmitry Jul 08 '16 at 05:56