NH version 1.0.2
This problem is related to concurrency, concurrent users are accessing the application and making change. Application contains a tree component which has nodes, subnodes, leafs etc. Constraint is u can not add duplicate node or subnode or leafs. Now i m storing all this structure in a object tree, this means when i save the data i store only the rootnode because it contains all the hierarchy of objects. It may happen that some nodes are added , some are modified , some are deleted in this tree. In this situation I need to implement the concurrency. Here are some of the scenarios for that.
1> User A, User B loads the tree component, user A created nodeA somewhere in the the tree and save it, after some time UserB created the node with the same name at the time of creation of that node on UI it validates that no such node exists but in the mean time UserA saves node with the same name. 2> userB has done some more changes and now saving, since nodeA is already created by UserA it should ask for concurrency conflict. 3> As i already say i m not saving a single record in the database through Nhibernate (otherwise i could have test it at the time of saving) , but its basically object tree (may contains multiple records with various operations on them) 4> Lastly i dontnot to add any version related column in my databases tables .
Can somebody plz tell me how can i implement the concurrency in this case
I can specify the following scenarieos and my understanding about that. Is there any way that i dont use the version, if version is mandatory for concurrency how it will address the following scenarios
1> UserA Added new node saves the node , user B created the node with the same name tries to save NH Solution : Here we can not use the version since there is no persistent state initially
2> UserA modified the node saves it then userB modified the node NH Solution: this can be handled by the version
3> UserA deleted the node, saves it now userB trying to delete the same node NH Solution: We can not use version because not persited state is there in the database
4> UserA deleted the node , saves and UserB trying to modify the same NH Solution :Again state is not available can not use version
5> UserA Modified the node , saves and UserB tries to delete that NH Solution: We can use the version here
|