Aug 08, 2006 - 01:56 PM
The issue was that I had some batch operations running every x hours updating some data and it seems that those were causing reads on the same data to be deadlocked.
So now I'm trying to let dirty reads be possible, when I'm doing those updates:
ITransaction tr = session.BeginTransaction(IsolationLevel.ReadUncommitted);
Any save is done within a transaction like this.
The problem is that it's difficult to test thoroughly, since the problems was only ocurring once in a while.
I'll post here again about the result.
Aug 24, 2006 - 10:40 PM
May 04, 2007 - 02:39 PM
Basically what happened was that i selected a bunch of objects, and looking at the sql trace i saw that they were all immediately updated to the database again. What happens is that if nhibernate detects a "dirty" object, i.e. it has a property that has changed value, it will try to save it to the database per default.
I had a property that i tried to define with my own enum class although it was an integer that was finally saved in the database. well, nhibernate saw that as dirty since the int was not equal to the enum type and therefore saved the object again. this made a huge amount of saves and caused deadlocks simply because the database was overloaded with updates to the same tables and registries.
hope this helps somebody...
Jan 25, 2009 - 04:25 AM