Hi Ingo,

The client should NOT post an update to the server after each edit 
event in the frame, for a variety of reasons including network traffic, 
server scalability, database performance, client responsiveness, 
data validation, and data consistency issues.

Instead, you want to provide "batch updates" to the server when the 
client presses your 'OK' button. Of course, you have correctly 
identified a problem: what happens if two users are editing the 
same data?

There is no appropriate mechanism built into the J2EE platform for 
handling what are sometimes known as "long transactions," that 
involve "client think time." There probably will not be such 
mechanisms in the near future, either; the solution is somewhat 
dependent on your particular situation. However, the two common 
approaches mirror two approaches for short transactions: 
pessimistic locking and optimistic locking.

In pessimistic locking, you use some sort of logical token (e.g. an 
entry in a database column) to prevent more than one user from 
editing the same data. In a sense, the user must check out the 
data before editing it.

In optimistic locking, you ensure that the data hasn't been changed 
by someone else before making a set of changes persistent. You 
can do this by querying against the original data, or by setting a 
last modified number or timestamp in a database column.

There are all sorts of details to consider with both approaches: e.g. 
for pessimistic locking: what happens if a user checks out data 
and goes on vacation; e.g. for optimistic locking: against what data 
should you check for concurrent modification, and how should the 
user interface respond?

As far as two concurrent modifications to the same entity bean (as 
opposed to two users editing the same data with different posting 
times), the application server will handle this for you--either by 
serializing updates to a single entity bean, or by deferring 
concurrency control to the persistent store.

Hope this helps,

Dan


On 18 Oct 00, at 16:24, Ingo Bruell wrote:

> Hi,
> 
> if I have a class like a Costumer in jBoss and the client will edit the
> Costumer Data, should the client edit the Data and if he press the 'OK'
> Button the data where transfered to the EJB or after the user leaves each
> editfield in the frame ?
> What will happen if two users are editing the same EntityBean ? On the
> database it depends on how the record is locked, is there a mechanism for
> EntityBeans too ?
> I think, if I get an EntityBean and his data, there is no lock, or am I on a
> woodway ?
> 
> CU
> 
> ---
> Ingo Bruell
> OBL GmbH ([EMAIL PROTECTED])
> Hude (Oldenburg)
> Germany
> 
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]
> 




--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to