I have two tables:
CalendarEntry
Id
Date
...
Holiday
Id
Date
...
In my CalendarEntry
class, I have a property like this
public ISet<Holiday> Holidays { ... }
which I want to associate to the Holiday
instances that occur on the same Date
as the CalendarEntry
. However, I can't come up with how to do this.
I've tried mapping it as one-to-many, but one-to-many automatically assumes that it should perform the join using CalendarEntry
's Id
column (presumably since it's the only property that is guaranteed to be unique, which it must be to be one-to-many).
I've tried mapping it as many-to-many, but it seems that many-to-many requires a separate join table, which I don't want in this case.
My question is: is it possible to map this in NHibernate, and how should I do it? If it's not possible, why?