2

I am doing some work on an application that uses an existing schema that cannot be altered. Whilst writing my NHibernate mappings I encountered a strange many-to-many relationship. The relationship is defined in the standard way as in this question with the addition of a boolean flag on the association table that signifies if the relationship is legal. This seems somewhat redundant but as I say, cannot be changed.

Is it possible to define this relationship in Nhibernate without resorting to using a third class to represent the association? Perhaps by applying a filter?

Many thanks.

Community
  • 1
  • 1
Nigel
  • 2,150
  • 3
  • 20
  • 22

1 Answers1

4

This is something I run into quite a bit with NHibernate and keep coming back to the following resources. This article explains how you can create the Many-to-Many association and This Question shows how you can create the filter on your Many-to-Many without having to map the actual association class.

Community
  • 1
  • 1
lomaxx
  • 113,627
  • 57
  • 144
  • 179
  • No problem. It's something I have to do often enough to know the resources, but not often enough to have committed it to memory yet :) – lomaxx May 04 '10 at 23:59