Does the Store have a HasMany reference back to the Employee?? I believe you probably end up multiple columns somewhere.
On Sat, Sep 19, 2009 at 7:45 AM, Mark Phillips <[email protected]>wrote: > > Hi, > > When I set the Column value of References, Fluent NHibernate generates > 2 table fields, 1 containing the value in Column, the other containing > the default Fluent NHibernate name. > > The code below creates these 2 fields in the Employee table: > Store_id > StoreId > > public class EmployeeMap : ClassMap<Employee>{ > public EmployeeMap() { > Id(x => x.Id).Column("EmployeeId"); > Map(x => x.FirstName).Not.Nullable(); > Map(x => x.LastName).Not.Nullable(); > References(x => x.Store).Not.Nullable().ForeignKey > ("FK_Employee_Store").Column("StoreId"); > } > } > > Here is the object being mapped: > > public class Employee { > public virtual int Id { get; private set; } > public virtual string FirstName { get; set; } > public virtual string LastName { get; set; } > public virtual Store Store { get; set; } > } > > How can I get NHibernate to name the Column in the Employee table > StoreId and not Store_id? Without the Column("StoreId") being added > to References, only the Store_id field is created in the table. > > Thanks, > Mark > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
