I have code that looks like this:
using (var session = this.sessionCreator.OpenSession())
using (var transaction = session.BeginTransaction())
{
session.SaveOrUpdate(anObject);
session.CreateSQLQuery(sql)
.ExecuteUpdate();
transaction.Commit();
}
Surprisingly, the SQL query executes before anObject is saved. Apparently, the ExecuteUpdate command does not participate in the current transaction. Is there any way to get the update to enlist in the transaction?