Hi,
in the online documentation, inside the paragraph
Optimistic concurrency control I have found:
The only approach that is consistent with high concurrency and high scalability is optimistic concurrency control with versioning. NHibernate provides for three possible approaches to writing application code that uses optimistic concurrency.
The first possible approach is the following:
Code:
transaction = session.BeginTransaction();
foo.Property = "bar";
session.Flush();
transaction.Commit();
session.Disconnect();
Applying this approch I note that between the commands
session.Flush() and transaction.Commit()
the system applies a pessimistic lock.
In my application for saving a collection (I need to save only single items under certain conditions) I have multiples
Code:
_session.SaveOrUpdate(entity);
_session.Flush();
and only one transaction.Commit(), at the end.
So my application is under pessimistic lock between the first session.Flush() and the final transaction.Commit().
The time is proportional to the collection lenght.
Someone can suggest me a way to avoid this problem?
Thanks
Antonella