NHibernate has a number of configuration options: Enabling statistics, Caching etc. You can check more from here
I will now talk about an unknown feature(well, at least I didn’t know until I implement SchemaValidator): hbm2ddl.auto
Hbm2ddl.auto is declarative way to use SchemaExport / SchemaUpdate / SchemaValidator (well the latter sounds odd, maybe it would be better to call it SchemaValidate, what do you think?). If you add
for example, it will run
new SchemaExport(cfg).Create(false, true);
during SessionFactory initialization, with which you probably are familiar.
There are several options for hbm2ddl.auto.
- update executes SchemaUpdate which will modify your existing table with new mapping, without dropping any columns.
- create-drop executes SchemaExport when SessionFactory initializes and drops the schema at the end of the life of the factory.
- validate executes SchemaValidator which I blogged about here
If you prefer not to use programatic way, configuration is just here.