I'm not an NHibernate expert, but as I understand it, using identity columns breaks UnitOfWork and causes extra round trips to the database.
Fabio Molo (then NHibernate project manager, I'm not sure if he still has one) has a blog post where he explains this in detail:
Identity: Endless Story
Here is another (longer) blog post with sample code:
NH2.1.0: Generator Behavior Explained
However, note that both blog posts are about three years old and talk about NH 2.1.0, and the current version to date is NH 3.3. But I suppose that the problem described by Fabio still exists today.
Christian specht
source share