NHibernate Saves Without Commit() or Flush()

Hi,

I have a strange situation.

An ASP.NET button click event causes an object in memory to be updated. The object was loaded from NHibernate via Refresh() during Page_Load, but at no time during the entire page life cycle is Commit() or Flush() called.

At some point after the page’s OnUnload step, the object and any changes made to it are automatically persisted to the database. I cannot see when or where or why this occurs.

Any ideas?

Cal

Can you post your code and mappings?

IIRC Hibernate does not have an in-memory query engine. For certain complex queries where you may be querying against entities which you may have changed, Hibernate will itself flush (but not commit). It does so to maintain “query consistency”. By flushing data it can use the db query engine (query the db).

BTW, this is my main gripe with Hibernate. It raises all kinds of issues, such as isolation, deadlocks etc.