This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
My application will potentially allow: User 1 - read data from a customer table User 2 - read same data from a customer table User 1 - update a field User 2 - update a field
It is possible User 2 is updating an out of date record (could be updating a different field, or indeed the same field)? Is there any way to prevent this from happening apart from insigating some field on every table that acts like a 'lock', by eg populating it with the sessionId of the first user to read that particular row (which seems very convoluted)?
My application services can be accessed through an EJB layer. The application also requires the ability to be deployed outside a J2EE container, consequently transaction management has been set to 'CMT', with the transaction attribute set to 'NotSupported' (rollbacks & commits are explicitly set by calls to commit() & rollback() on the jdbc connection) as mentioned here. Can you provide any tips to help me in this concurrent access nightmare - I am sure I am not the firt person to come across this?
Hi, You are talking about stale data problem. There are many strategies to handle this situation.U can use optimistic locking / passimistic locking. you can use the transaction isolation levels provided by the appserver+database. The best I found is in ejbDesignPattern book, which uses a version field to track stale data. The decision depends on you based on the kind of update/read operation you are going to have. But do go through the ejbDesignPattern book and it will clear many issues. U could also try Mastering EJB 3rd edition. These two free books from serverside.com made my life much easier. Hope it helps. Regards, Sajid
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com