I'm assuming you're talking about something separate tx?  So

1. User1 views entity, and sees status as X
2. User2 views entity, and sees status as X
3. User1 updates entity status to Y
4. User2 updates entity status to Z

and each action is a separate HTTP request?

In that case, what you want is soft-locking dataobjects (well, this is one solution).

so , in step one, User1 calls getData() and gets a data object with a hidden version 
flag.  when user2 calls getData(), it gets the
same data version because everything is the same.  but then when user1 updates, they 
call setData(), passing in the same data object
from getData, but they have updated the values.  The entity checks to see the version 
is right, and because it changes values, it
notes that the old version is no longer valid.  Then, when user2 goes to update, then 
entity 'knows' that something has changed
since the data object was obtained, and complains.  your app can then re-query, and 
inform user2 that something had changed, and
allow them to decide what to do.

this is all code that ordinarily you would have to write, but XDoclet 
(http://sf.net/projects/xdoclet) does a wonderful job of
generating.  I'd advise you to look into XDoclet fullstop - it'll save you a lot of 
time.  And better still, if you think the above
pattern would be useful, it will generate the code to do it.

hth
dim

----- Original Message -----
From: "john" <[EMAIL PROTECTED]>
To: "Jboss List" <[EMAIL PROTECTED]>
Sent: Wednesday, March 20, 2002 2:47 PM
Subject: [JBoss-user] Concurrency Issue


> Hi All,
> I need to find out how Jboss handle concurrencies.
>
> say if user 1 and user 2 is accessing website and reading info about entity
> beanA
> both are "holding on" to enitity bean A.
> say Bean A has Status, with value of X.
> now if user1 update Status to Y.
> follow shortly by user2 updating to another value Z.
> i would think the Status of Bean A will take on the later value of Z.
>
> the problem is both user think they are updating from Status X.
> User1     X ->Y
> User2     X ->Z
>
> Transaction are container-managed
> Enitity Beans are Bean-managed.
> well, i hope you get the point and im not confusing anyone.
> i did read about isolation leve,but i think in this case is not it.
> thanks.
>
> John
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to