views:

41

answers:

1

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 read 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?

+4  A: 

You need to implement optimistic concurrency control: http://nhforge.org/doc/nh/en/index.html#transactions-optimistic

The most performant way is adding a <version> to your entities (see http://nhforge.org/doc/nh/en/index.html#mapping-declaration-version)

Diego Mijelshon
Thanks for replying. How can I use isolation?