What is the best option, transaction locking for distributed systems?
I am using NHibernate and really new to that. My dilemna is when I open a web browser, it shows the table data. Meantime another person opens another web browser and hence r开发者_开发问答ead the existing data from the database.
Meantime, I make changes in the my pages and save. And the user save his changes afterwards. When I reload the page, I no more find my data, but that of the user, i.e his was the latest and mine were replaced.
How can I avoid this issue?
You need to implement optimistic concurrency control: http://nhibernate.info/doc/nhibernate-reference/transactions.html#transactions-optimistic
The most performant way is adding a <version>
to your entities (see http://nhibernate.info/doc/nhibernate-reference/mapping.html#mapping-declaration-version)
精彩评论