We are trying to explore possibilities of following:
1. user1 loads an object from db, changes some properties on it and after validations tries to save it. Meanwhile user2 logs in and deletes that item even before user1 sent an update(). How would hibernate trap the deletion and let user1 know that no object exists ?
2. user1 loads object from db, changes properties, tries saving it. Meanwhile user2 concurrently does same and is successful in saving the state of object before user1. Before user1 actually calls save() can the concurrent update be known? In other words user1 now has stale data that he is updating. Can he know that it is stale and be alerted ?
3. How and what do we need to achieve locking on rows so that concurrent edit/update wouldn't even be possible and user2 would be alerted right away when he tries any edit/delete/update ?
4. Does hibernate caching play a role in above scenarios ? How does hibernate know that db state of certain object changed ? Do we have to write extra code checking properties or would hibernate do it for us ?
I need specific information on how to configure such scenarios. Any sample code/snippets that you can provide would be very helpful.
Thanks in advance,
Sameer
|