what is the best code generator for NHibernate?
See the "Helpful Tools For NHibernate" section on this NHibernate page and choose one based on what you're looking for. Do you want free? Commercial? Do you want Visual Studio integration?
All of the listed code generators there are good, there is no general best without knowing what you need.
ActiveWriter for NHibernate is the most supported, up to date, free option, although it does an incomplete job.
I put together a quick start guide using Active Writer:
Using Linq with NHibernate : A Quick Start
See also this question:
http://stackoverflow.com/questions/41752/nhibernate-generators
Code Smith appears to be the leading commercial option, although I haven't tried it myself.
I'm using NConstruct; they offer also a free version - NConstruct Lite. I miss SQL 2008 support otherwise I find it very easy to use.
There is a free and open source tool. NHibernate Mapping Generator.
There a new 2.0 Beta 2 release available with lots of new features and support for fluent nhibernate, one-to-many and many-to-many mapping.