Is the only solution here to use a manually created an HBM file for my
Business entity and its joined subclasses?

Has no one else seen this problem?

On Aug 5, 2:25 pm, Chris Fazeli <[email protected]> wrote:
> Hi again,
>
> Can anyone give this a second look and give me even a guess? I'd
> appreciate it.
>
> Thanks,
> -Chris
>
> On Aug 3, 12:27 pm,ChrisFazeli<[email protected]> wrote:
>
> > Hi,
>
> > I posted about this in another post, but thought it might have gotten
> > buried under the wrong 
> > "Subject":http://groups.google.com/group/fluent-nhibernate/browse_thread/thread...
>
> > I have two tables that have two separate references to each other:
> > 1-to-many: 1 Manager to Many Customers (as PrimaryManagers)
> > many-to-many: Many Managers to Many Customers (as SecondaryManagers)
>
> > Both of my domain model entities (Manager and Customer) inherit from
> > the same base Business class (joined subclasses).
>
> > While I can get the many-to-many to map correctly using an automapping
> > override on the Business class, I cannot get the 1-to-many to map
> > correctly:
>
> > // Does not work correctly
> > mapping.JoinedSubClass<Manager>("BusinessId")
> >        .HasMany(x => x.ManagedCustomers)
> >        .KeyColumnNames.Clear()
> >        .KeyColumnNames.Add("PrimaryManagerFk")
> >        .Inverse();
>
> > // Works in this direction
> > mapping.JoinedSubClass<Customer>("BusinessId")
> >        .References<Manager>(x => x.PrimaryManager);
>
> > Here's the output I get:
>
> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
> > access="">
> >   <class name="Project.Business, Project, Version=1.0.0.0,
> > Culture=neutral, PublicKeyToken=null" table="Businesses"
> > xmlns="urn:nhibernate-mapping-2.2">
> >     ...
> >     <joined-subclass name="Project.Manager, Project, Version=1.0.0.0,
> > Culture=neutral, PublicKeyToken=null" table="Managers">
> >       <key column="BusinessId" />
> >      ...
> >       <bag name="Customers" inverse="true"
> > table="ManagersToCustomers">
> >         <key column="ManagerFk" />
> >         <many-to-many column="CustomerFk" class="Project.Customer,
> > Project, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
> >       </bag>
>
> > <!-- INCORRECT MAPPING STARTS -->
>
> >       <bag name="ManagedCustomers" inverse="true">
> >         <key column="ManagerFk" />
> >         <one-to-many class="Project.Customer, Project,
> > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
> >       </bag>
>
> > <!-- INCORRECT MAPPING STOPS -->
>
> >     </joined-subclass>
> >     <joined-subclass name="Project.Customer, Project, Version=1.0.0.0,
> > Culture=neutral, PublicKeyToken=null" table="Customers">
> >       <key column="BusinessId" />
> >       ...
> >       <bag name="SecondaryManagers" table="ManagersToCustomers">
> >         <key column="CustomerFk" />
> >         <many-to-many column="ManagerFk" class="Project.Manager,
> > Project, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
> >       </bag>
> >       <many-to-one name="PrimaryManager" column="PrimaryManagerFk" />
> >       ...
> >     </joined-subclass>
> >   </class>
> > </hibernate-mapping>
>
> > What am I doing wrong? I've tried every tutorial and example, but
> > can't get the KeyColumnName to be correct.
> > -Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to