Issue has already been reported here<http://code.google.com/p/fluent-nhibernate/issues/detail?id=58> :) I believe there's even a patch there for you.
Also, what you're looking to do is a many-to-one reference, not a one-to-one (the O-T-O would be wrong in this case, so you're doing it correctly, I just wanted to make sure you understood the difference in terminology). On Thu, Apr 30, 2009 at 3:53 AM, JamesSpibey <[email protected]> wrote: > > Hi, > > I am trying to map two tables together through a composite key but > can't seem to find the correct syntax. > > Database Tables > > ORD_Customer > ------------ > ReqPointID > WhseCode > District > StockLocationCode > NonStockLocationCode > > ORD_Address > ------------- > WhseCode > District > LocationCode > > > The primary key on ORD_Customer is ReqPointID. > The primary key on ORD_Address is WhseCode/District/LocationCode. > > StockLocationCode & NonStockLocationCode are foreign keys to > ORD_Address BUT they also need the WhseCode and District fields to get > a unique match. > > CustomerMap > > WithTable("ORD_Customer") > Id(Function(x) x.CustomerID, "ReqPointID") > Map(Function(x) x.WhseCode) > Map(Function(x) x.District) > References(Function(x) x.StockAddress, "StockLocation") > References(Function(x) x.NonStockAddress, "NonStockLocation") > > AddressMap > WithTable("ORD_Address") > > UseCompositeId() _ > .WithKeyProperty(Function(x) x.AddressID, > "LocationCode") _ > .WithKeyProperty(Function(x) x.WhseCode) _ > .WithKeyProperty(Function(x) x.District) > > ---------------------- > > So, my question is how should the References() calls be structured in > order to correctly map the WhseCode & District fields along with the > LocationCode fields? > > Thanks > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
