Karl Gjertsen

Architect, Developer, Speaker, Bad Golfer,
Raygun brand ambassador and creator of Infiniforms

Monthly Archives: October 2015

nHibernate: Flush vs Commit

Whilst working on a legacy project, I had to look at an issue with using nHibernate and ran into the Flush method. As I was new to nHibernate, I had to investigate what this did! using (var transaction = session.BeginTransaction()) {     session.Save(entity);     session.Flush();     transaction.Commit(); } Calling Flush on the Session synchronises the data in the session with the data in the database. Using Flush():…