Ok. For comparison (maybe you can spot something I didn't).

First, the class:

using System.Collections.Generic;

namespace Genesis.Domain
{

    public class Forum
    {

        private IList<Forum> forums = new List<Forum>();

        private IList<Moderator> moderators = new List<Moderator>();

        private IList<Thread> threads = new List<Thread>();

        public virtual int Id { get; protected set; }

        public virtual int Sequence { get; set; }

        public virtual string Title { get; set; }

        public virtual string Description { get; set; }

        public virtual bool Moderated { get; set; }

        public virtual bool Enabled { get; set; }

        public virtual bool Visible { get; set; }

        public virtual IEnumerable<Forum> Forums { get { return
forums; } }

        public virtual IEnumerable<Moderator> Moderators { get
{ return moderators; } }

        public virtual IEnumerable<Thread> Threads { get { return
threads; } }

        public virtual void AddForum(Forum forum)
        {

            if (!forums.Contains(forum))
                forums.Add(forum);

        }

        public virtual void RemoveForum(Forum forum)
        {

            if (forums.Contains(forum))
                forums.Remove(forum);

        }

        public virtual void AddModerator(Moderator moderator)
        {

            if (!moderators.Contains(moderator))
                moderators.Add(moderator);

        }

        public virtual void RemoveModerator(Moderator moderator)
        {

            if (moderators.Contains(moderator))
                moderators.Remove(moderator);

        }

        public virtual void AddThread(Thread thread)
        {

            if (!threads.Contains(thread))
                threads.Add(thread);

        }

        public virtual void RemoveThread(Thread thread)
        {

            if (threads.Contains(thread))
                threads.Remove(thread);

        }

    }

}


Next, the map (set to Embedded resource btw):

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="Genesis.Domain">

  <class name="Forum" table="Forums">

    <id name="Id">
      <generator class="native" />
    </id>

    <property name="Sequence" />
    <property name="Title" />
    <property name="Description" />
    <property name="Moderated" />
    <property name="Enabled" />
    <property name="Visible" />

    <set name="Forums" cascade="all" access="field.camelcase">
      <key column="ForumId" />
      <one-to-many class="Forum" />
    </set>

    <set name="Moderators" cascade="all" access="field.camelcase">
      <key column="ForumId" />
      <one-to-many class="Moderator" />
    </set>

    <set name="Threads" cascade="all" access="field.camelcase">
      <key column="ForumId" />
      <one-to-many class="Thread" />
    </set>

  </class>

</hibernate-mapping>

Forums is recursive as you can see. If you need more, let me know. And
thanks for taking your valuable time to assist me.



On Aug 21, 9:15 pm, John Davidson <[email protected]> wrote:
> How about posting any hbms with reference to the Moderator class?
>
> John Davidson
>
> On Sat, Aug 21, 2010 at 9:01 PM, [email protected] <
>
>
>
> [email protected]> wrote:
> > Ok, I quadruple-checked just now, as per your suggestions. Everything
> > matches up. Maybe I'm not doing something right. I am not going to
> > post a ton of code unless you ask, but here's the basics:
>
> > Genesis.Domain.dll - contains the entities
> > - Genesis.Domain.Code
> > - Genesis.Domain.Favorite
> > - Genesis.Domain.Forum
> > - Genesis.Domain.Moderator
> > - Genesis.Domain.Reply
> > - Genesis.Domain.Subscription
> > - Genesis.Domain.Thread
>
> > Genesis.Persistence.dll - contains the mappings
> > - Genesis.Persistence.Mapping.Code.hbm.xml
> > - Genesis.Persistence.Mapping.Favorite.hbm.xml
> > - Genesis.Persistence.Mapping.Forum.hbm.xml
> > - Genesis.Persistence.Mapping.Moderator.hbm.xml
> > - Genesis.Persistence.Mapping.Reply.hbm.xml
> > - Genesis.Persistence.Mapping.Subscription.hbm.xml
> > - Genesis.Persistence.Mapping.Thread.hbm.xml
>
> > All public properties match between entity, map and table. There is
> > one exception however...
>
> > The Thread and Reply entities both map to the Posts table, but they
> > have the appropriate table="" attribute, so it shouldn't be a problem.
> > I've been messing with this for a long time now (months), and am about
> > to explode...
>
> > Is there any code, or hbm you'd like to see that might help? Perhaps
> > one of the maps with a <set> in it?
>
> > On Aug 21, 7:32 pm, John Davidson <[email protected]> wrote:
> > > Try to ensure that the class definition and properties match exactly to
> > the
> > > hbm and that the table definitions in your RDBM also match.
>
> > > John Davidson
>
> > > On Sat, Aug 21, 2010 at 7:02 PM, [email protected] <
>
> > > [email protected]> wrote:
> > > > I have about 9 hbm's. This is the only one giving me the "cannot
> > > > compile x - class not found" error. Any idea what's wrong? I've
> > > > tripple-checked the spelling in ALL the hbm's. No errors found.
>
> > > > <?xml version="1.0" encoding="utf-8" ?>
> > > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> > > > assembly="Genesis" namespace="Genesis.Domain">
>
> > > >  <class name="Moderator" table="Moderators">
>
> > > >    <id name="Id">
> > > >      <generator class="identity" />
> > > >    </id>
>
> > > >    <property name="UserId" />
>
> > > >  </class>
>
> > > > </hibernate-mapping>
>
> > > > --
> > > > 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]<nhusers%[email protected]­>
> > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup­s.com>
> > ­>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/nhusers?hl=en.-Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > 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]<nhusers%[email protected]­>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
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