I have two classes and map files listed below which generates a query
like this (select list has been condensed):

SELECT this_.*, backstockl2_.*, location3_.*
FROM [FloorFill] this_
left outer join InventoryLocations backstockl2_ on
this_.Id=backstockl2_.ItemReference
left outer join [Location] location3_ on
backstockl2_.LocationId=location3_.Id

What changes do I need to make so that the first join statement
compares  this_.ItemRefence to the backstockl2_.ItemReference instead
of this_.Id to backstockl2_.ItemReference ?

public class FloorFill : EntityBase //Id, Created and Modified
datetime
{
     public virtual ProductCatalog Catalog { get; set; }
     public virtual Inventory BatchedItem { get; set; }
     public virtual Transaction Batch { get; set; }
     public virtual int ItemReference { get; set; }
     public virtual IList<InventoryLocation> BackstockLocations { get;
set; }
}

// database view
public class InventoryLocation : IEquatable<InventoryLocation>
{
     public virtual int Id { get; set; }
     public virtual int ItemReference { get; private set; }
     public virtual Location Where { get; set; }
     public virtual int HowMany { get; set; }
}

public class FloorFillMap : EntityBaseMap<FloorFill>
{
     public FloorFillMap()
     {
          Map(x => x.ItemReference);
          References(x => x.Catalog, "ProductCatalogId")
                                                .WithForeignKey();
          References(x => x.Batch, "TransactionId")
                                                .WithForeignKey()
               .Cascade.SaveUpdate();
          References(x => x.BatchedItem, "InventoryId")
                                                .WithForeignKey()
                                                .Cascade.SaveUpdate();
          HasMany(x => x.BackstockLocations)
                                                .KeyColumnNames.Add
("ItemReference")
                                                .Inverse()
                                                .Cascade.None
().FetchType.Join();
      }
}

public class InventoryLocationMap : ClassMap<InventoryLocation>
{
                public InventoryLocationMap ()
                {
                                WithTable("InventoryLocations");
                                Id(x => x.ItemReference);
                                References(x => x.Where, "LocationId")
                                                .FetchType.Join()
                                                .Cascade.None();
                                Map(x => x.HowMany);
                                Map(x => x.ItemReference);
                                ReadOnly();
                }
}

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