I'm getting the following NHibernate error: "Repeated column in
mapping for collection: Settings.CategorySpecificSettings column:
SettingsID".

My tables are pretty simple I think:

        Categories
        ----------
        CategoryID: int
        Name: varchar(50)

        Settings
        --------
        SettingsID: int
        SomeSetting: bool

        CategorySettings
        ----------------
        SettingsID: int
        CategoryID: int
        OverrideSetting: bool

The classes, too, are relatively simple.  Note that the *child*,
CategorySettings, has a reference to the *parent*, Settings:

        public class Settings
                ...
                public IDictionary<Category,CategorySettings>
CategorySpecificSettings { get; set; }

        public class CategorySettings
                ...
                public Settings MasterSettings { get; set; }
                public bool OverrideSetting { get; set; }

I suspect I'm not mapping correctly, but I can't decipher the
documentation enough to figure out what I'm doing wrong here:

        <map name="CategorySpecificSettings" table="CategorySettings">
          <key column="SettingsID"/>
          <index-many-to-many  column="CategoryID" class="Category" />
          <composite-element class="CategorySettings">
            <many-to-one name="MasterSettings" column="SettingsID" />
            <property name="OverrideSetting"/>
          </composite-element>
        </map>

I can't remove "<key>", but when my composite element also has the
MasterSettings mapped, NH doesn't like it.

Am I barking up the wrong tree?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.

Reply via email to