The xml mapping uses a hbm.xml file which is a hibernate mapping file. It is a syntax xml file which contains the metadata required for the object/relational mapping. The metadata includes declaration of persistent classes and the mapping of properties (to columns and foreign key relationships to other entities) to database tables.
Add a file named Entity.hbm.xml into the project and set it as embedded resource on the properties tab. For sample, Customer.hbm.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="Project" assembly="Project">
<class name="Customer" table="CUSTOMERS">
<id name="Id">
<column name="Customer_Id" sql-type="int" not-null="true"/>
<generator class="native" />
</id>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="Name">
<column name="Name" length="60" not-null="true" />
</property>
<property name="Sex" />
<property name="Weight" />
<property name="Active" />
<property name="Birthday" />
</class>
</hibernate-mapping>
The hibernate-mapping tag contains the namespace and assembly project information. The class tag contains the name of the entity on the project and the table which is been mapped. The id tag contains the mapping for the primary key where the column is specified by the column tag and generator tag define how the id is generated. The property tag contains information for the other columns in the database.