A: 

It seems we have the same problem:

http://stackoverflow.com/questions/1372399/how-to-map-this-in-fluent-nhibernate

I just used hbm.xml (that was generated by Fluent.Nhibernate in my project) I modified it a little oufcourse. If you set

 .Mappings(m =>
   {                                             
       m.FluentMappings.AddFromAssemblyOf<DomainClass>()
                       .ExportTo("Path");
       m.HbmMappings.AddFromAssemblyOf<DomainClass>();
   })

and if you have both ClassMap and hbm.xml the hbm.xml should override the ClassMap, so you'll be fine untill it's fixed.

I also need natural-id for my class and it also isn't supported with Fluent.Nhibernate, so I had no choice but to use hbm.xml

dmonlord
Yeah, this is currently the way I am doing things as well. Unfortunately I have a fairly heavy class which, while it has a lot of properties which can be mapped with fluent, also has an IDictionary<SomeEntity,int>. My 'solution' so far as been to seperate the functionality into separate classes (one mapped fluently, one via raw hbm.xml) and use a one-to-one mapping, but for performance reasons it is now desireable to eliminate the join/extra select that occurs from this. (see http://groups.google.com/group/fluent-nhibernate/browse_frm/thread/b5fe376e257436e9/35d9cf5cef4303d0 )
fostandy
+1  A: 

I ran into the same problem, and wasn't happy with mixing fluent and hbm mappings. You can see my fix here.

Maxild
+1  A: 
HasMany(x => x.Foo)
    .KeyColumn("BarId")
    .Element("IntValue")
    .AsMap<SomeEntity>("SomeEntityId")
    .AsTernaryAssociation("SomeEntityId");
xhafan