SQL Server doesn’t support the “SELECT FOR UPDATE” syntax, which is used by NHibernate for pessimistic locking.
I read here on StackOverflow descriptions of other alternatives (I liked the “SELECT WITH (…)” because it’s quite close).
however NHibernate doesn’t seem to support this syntax.
do you have a workaround for this?
I believe this can be achieved by tinkering with NHibernate internals, but that’s not cost effective for me at the moment (learning curve).
I could also perhaps use a stored procedure with application locks, and access that from NHibernate.
any other suggestions?
(aside from always reading before writing…)
NHibernate has a version strategy for optimistic locking:
http://ayende.com/Blog/archive/2009/04/15/nhibernate-mapping-concurrency.aspx