Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2.5
Mapping documents:
n/a
Code between sessionFactory.openSession() and session.close():
n/a
Full stack trace of any exception that occurs:
n/a
Name and version of the database you are using:
MS SQL Server 2005 SP2
The generated SQL (show_sql=true):
n/a
Debug level Hibernate log excerpt:
n/a
I was wondering whether there is a way in Hibernate to force SQL server to use row locks when performing deletes and updates?
We have a problem with deadlocks occurring when large numbers of very short transactions are processing small numbers of rows across a couple of tables. Since the default is to use page locking this can result in deadlocks.
I tested this by modifying the Hibernate source to add 'WITH (ROWLOCK, HOLDLOCK)' to the UPDATE and INSERT SQL. This combined with using clustered indexes fixed the deadlock problem. This is something we have seen before in previous C/C++ applications when using SQL via ODBC.