Two common approaches are a timestamp and an ever increasing number, you
don't need to 'generate' either you just store the last one in your entity
and either get the current timestamp on update, or increment the number on
update.  I prefer the number one as the granularity of the system or
database time can cause problems if it is not fine enough, but with a number
you have to consider getting large, or else rolling over at some point.

Cheers

-----Original Message-----
From: Ingo Bruell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 19, 2000 9:13 AM
To: jBoss
Subject: Re: Re[2]: [jBoss-User] Clients and Transaction Design


Hi Dan,

> One problem with this approach is that session beans are intended
> for a single client only. The locking information would still need to
> be stored in a resource or component accessible from more than
> one client.

I see ...

> > Is it possible to start a transaction from the client and commit it from
the
> > client ?
>
> 1. Not portably, unless the client is also a web component or EJB
> component.
>
> 2. You should not maintain a transaction across client think time.
>
> A nice, general solution is to have a token (perhaps a counter,
> obtained from Rickard's contributed classes) as part of the entity's
> state, that is updated with each modification. When the client
> retrieves data from an entity, it also retrieves the token. When the
> client updates the data, it must also present the token--which the
> entity then checks to ensure no intervening modifications have
> occurred. This is easy to implement, and probably not too coarse-
> grained for most purposes, if you don't mind adding a field to each
> entity.
Yes, I thought about such but was thinking abaut a hashkey or somewhat.
Is the stuff from Rickard available for download ? Or how can I generate
such a token ?

I think its the best solution, because the situation that two users
(clients) change the same EntityBean is not often, I think.

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