by Scott MIllett
6. February 2011 16:00
I get asked this question a fair bit so I thought I may as well stick it up here so I can refer people to this post in future. If you are using the NHiberante native ID generator — that is, letting your database generate IDs for entities — the database will actually be hit when save is called regardless if you are in a transaction or not. This is because the entity is now part of the unit of work and thus NHibernate needs to give it a valid identity to ensure that any other objects that reference it can be persisted correctly. You can read more about this over on Ayende's blog.
Don't have nightmares
Scott