Implementation of Entity Beans
Hi..
Can anyone help me in my doubts?
Whenever i have an entity bean object , and say at given instant of time more tan one user wants to update the data that the entity bean represent.
Take a particular case:
One user calls an entity bean modifies itzz state say one field but doesn't commit , now at the same time some other user modifies the state say another field and commits it.
What will happen to the modification made by the first user?are they lost or they are also commited with it.Now the first user undo itzz changes and commit it . What will be the state of the entity bean?
Thankzz in advance !!
Somilj
[674 byte] By [
somilj] at [2007-9-26 5:45:29]

If this is so , suppose i have a situation where there are say n number of users trying access my application ,at entry point they all have to access a record with same primary key (may be for a particular organization)and make some modification,now if one user holds on with the record what about other users? How long will they wait? This approach will then degrade performance.
Any alternative solution for the above scenarieo.
Thankzz
Somilj
If this is so , suppose i have a situation where there are say n number of users trying access my application ,at entry point they all have to access a record with same primary key (may be for a particular organization)and make some modification,now if one user holds on with the record what about other users? How long will they wait? This approach will then degrade performance.
Any alternative solution for the above scenarieo.
Thankzz
Somilj
You first need to understand why two users would update the same row at the same time, and then define what you wish the expected results to be (the behaviour of locking all other users whilst one user updates data may be what you require).
Once you understand your desired behaviour, you can then consider how isolation levels and transactions help achieve that behaviour.
Loosely speaking, you can consider a transaction as an atomic operation on data in a database (enterprise resource), and Isolation levels as how that data may be manipulated when held in a transaction.
You can set isolation levels per entity bean method (e.g. SERIALIZABLE or REPEATABLE_READ) and indicate, per session bean method how it partakes in any transaction (e.g.TX_REQUIRED or TX_NOT_SUPPORTED).
For example, suppose you need to set some data in a row, perform a lot of other calculations controlled by a session bean, using other session and entity beans, then allow that data to be changed by someone else. To do so, it is likely that you would include all entity/session beans in a container managed transaction with the isolation level for the data set to serializable. Here the data would be 'locked' until the complete operation had finished.
Suppose you only need to lock the data for a small part of the overall computation, then you could choose to use several container managed transactions, or place the update of data outside a transaction, or use explicit Bean Managed Transactions (where the code you right manages the transaction).
Adam
> Hi..
>
> Can anyone help me in my doubts?
> Whenever i have an entity bean object , and say at
> given instant of time more tan one user wants to
> update the data that the entity bean represent.
>
> Take a particular case:
>
> One user calls an entity bean modifies itzz state say
> one field but doesn't commit , now at the same time
> some other user modifies the state say another field
> and commits it.
> What will happen to the modification made by the first
> user?are they lost or they are also commited with
> it.Now the first user undo itzz changes and commit it
> . What will be the state of the entity bean?
>
> Thankzz in advance !!
> Somilj