When I update (with a flush) one record in a list of records retrieved from the database nHibernate is versioning all of the records that were in the original list.
Retrieving a list of records from the database:
using(UnitOfWork.Start())
{
queuedJobs = aJobServiceManager.GetAllJobs().Where(aJob => aJob.Status == PricingStatus.QUEUED).ToList();
}
/* Do some work on the record*/
using(UnitOfWork.Start())
{
//aJob is a record from queuedJobs.
aJobServiceManager.Save(aJob);
//When Flush is called I'm expecting only aJob to be updated in the database.
//aJob is correctly updated BUT
//All the other records in queuedJobs are also updated (their version field is incremented).
UnitOfWork.Current.Flush();
}
Why is nHibernate updating all the records when they haven't changed and how do you stop this behavior?