> your mappings look fine Thanks Paul, that was the main thing I wanted to know. (I am a fluent nhibernate newb)
I will try HQL and see how I go. On Sep 16, 2:30 am, Paul Batum <paul.ba...@gmail.com> wrote: > I don't use the criteria API so nothing jumps out unfortunately. You could > try writing the query using HQL to determine whether the problem is your > usage of the criteria API. > > You could also try asking on the nhibernate > users<http://groups.google.com/group/nhusers/> mailing > list, your question is more about NH usage than the FNH mappings (your > mappings look fine). > > On Mon, Sep 13, 2010 at 3:48 PM, Alistair <alistair.burro...@gmail.com>wrote: > > > Hi, > > > I have the following relationship: > > > Page HasMany Areas. > > > Mapping: > > > public class PageMapping : IAutoMappingOverride<Page> > > { > > public void Override(AutoMapping<Page> mapping) > > { > > mapping.HasMany(p => p.Areas) > > .KeyColumn("PageId"); > > } > > } > > > public class AreaMapping : IAutoMappingOverride<Area> > > { > > public void Override(AutoMapping<Area> mapping) > > { > > mapping.References(a => a.Page) > > .Column("PageId"); > > } > > } > > > However: I can't force it to eager load when I query the database, > > even though the query will return all the data as expected. > > > return Session.CreateCriteria(typeof (Page)) > > .CreateAlias("Areas", "area") > > .SetFetchMode("area", FetchMode.Join) > > .Add(Restrictions.Eq("Name", pageName)) > > .UniqueResult<Page>(); > > > So then when I call: > > > homePage.Areas > > > I query is sent to the database to fetch the areas for the home page, > > even though they did come back in the query results. > > > I am using Sharp Architecture 1.6 btw. > > > Am I missing something? > > > -- > > You received this message because you are subscribed to the Google Groups > > "Fluent NHibernate" group. > > To post to this group, send email to fluent-nhibern...@googlegroups.com. > > To unsubscribe from this group, send email to > > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/fluent-nhibernate?hl=en. -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibern...@googlegroups.com. To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.