Hi, I am having problem with one of the logic that how stateless beans can be used for transactions? ATM's also uses the logic of stateless beans. But the problem is when one is doing the transaction, how can we guarantee that the same person/ or other using his id, can do the transaction at the same time?
Transactions provide something called ACID. That means that the work you do within the transaction is Atomic, Consistent, Isolated, and Durable. I think the one you are asking about is Isolation. Transactions are isolated from each other. That means that whatever I do in my transaction won't mess up anything you are doing. Even if we do the work at the same time or whatever. Databases can choose to implement this isolation in many different ways, but they basically come down to some form of locking or versioning. A database might put a lock on the table or row so that the second transaction is stalled until the first one finishes. This is called Serializable access to the data. Or, a database might use Optimistic Locking - it keeps track of a version id for the data, and when the second transaction commits, if it sees "wrong version" it throws an exception. There's a bit more to it than that, but the main thing to know is that this is a function of the transaction (or, more specifically of the transactional resource such as database). I'm not sure I really understood your question - did I get anywhere close?
Yes Dave, I agree with your view that we can set ACID properties of the business methods. & also about Database row level locking. I got that well. But & one more thing to clear about is, The properties which supports during CMP, will be applicable to StatLess. Bean or not? ie- if i do transaction, in stateless / CMP what will be the net effect to Server? & which will offer good performance? & b'Cause CMP does not supports retrieval of heap of rows from d/b, Wheather it is applicable to Statless too?