Hi,
I can think of a few ways of handling this (there will probably be more, but this is just what comes to mind):
1 - Upgrade the locking:
You can upgrade the lock on the object when you read it. Bear in mind this will probably serialise access to a given row in the database, and might cause contention. The best way is to try it and stress test it.
Code:
MyObject myObject = session.Get<MyObject>(11, LockMode.Upgrade);
2 - Use a regular ADO.Net command object:
You can use a regular ADO.Net command object on the same session/transaction objects you already have:
Code:
ISession session = sessionFactory.OpenSession();
ITransaction transaction = session.BeginTransaction();
IDbCommand cmd = session.Connection.CreateCommand();
transaction.Enlist(cmd);
cmd.CommandText = "update table1 set visitCount=visitCount+1 where id=11";
cmd.ExecuteNonQuery();
3 - Upgrade to NH2.0
The current trunk code has the ability to do DML-style statements in HQL. Note, NH2.0 isn't in Alpha yet (although it's very close, and it may only be a couple of months till the first GA release - no guarantees though).
http://www.hibernate.org/hib_docs/reference/en/html/batch.html#batch-direct
I hope one of these helps.
Regards,
Richard