static void

NHibernate Mapping

See simple examples. Add the .hbm.xml files as "Embedded Resource". The number one error!
You can add xml intellisense by copying the nhibernate-mapping.xsd file to %ProgramFiles%/Microsoft Visual Studio 10.0\Xml\Schemas.

Mapping to tables

Identity

generator can be:

native (or identity or sequence)
Integer auto-assigned primary keys - Identity columns in SQLServer, sequences in Oracle.
Entities are not just saved at Flush/Commit.
guid or guid.comb
NHibernate assigns a guid (guid.comb uses datetime to make sequential ids).
hilo
Read unique keys from table (eg hibernate_unique_key).
assigned
Natural keys. New entities must be saved with ISession.Save, not SaveOrUpdate.

Composite keys - use <composite-id class="KeyClass"> <key-property ... (or key-many-to-one for FK-objects)
The KeyClass must omplement Equals, GetHashCode and be serializable.
The bags should specify <key> <column .../> <column ... in the same order.
Tables that have foreign keys/ many-to-one should also specify both columns.

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Northwind" assembly="Northwind">
  <class name="OrderDetail" table="`Order Details`">
    <composite-id name="Key" class="OrderDetailKey">
      <key-property column="`OrderID`" name="OrderId" />
      <key-property column="`ProductID`" name="ProductId" />
    </composite-id>
    <property name="UnitPrice" column="`UnitPrice`" type="System.Decimal" not-null="true" />
    <property name="Quantity" column="`Quantity`" type="System.Int16" not-null="true" />
    <property name="Discount" column="`Discount`" type="System.Single" not-null="true" />
  </class>
</hibernate-mapping>

After the id, add a <version name="Version" column="VERSION"> (Version should be an int; it's not a database TIMESTAMP).
Alternatively use <class ... optimistic-lock="all" to update ..where col=origValue. Or, with care, optimistic-lock="dirty"/dynamic-update="true" or select-before-update="true".

Property

Collections- Foreign Keys

Simple association tables can be mapped as many-to-many (no class is needed for the association table).

<bag name="Categories" outer-join="true" table="PRODUCTCATEGORY" access="nosetter.camelcase-underscore">
  <key column="ProductID"/>
  <many-to-many column="CategoryID" class="Category"/>
</bag>