invisiblemage wrote:

>So, are we talking of "real" clients, that read some data, display it to the user, 
>and after 20 minutes the user commits new data? 

Yes.

>Then it is really no good practice to keep the entity-reference on the client (with a 
>transaction open ?!!) - the client should never ever have direct access to an entity 
>bean. 
instead, implement some VO-Pattern here. 

I followed the Session Facade Pattern.
Clients use a Stateful Session Bean to change DB data.
This could be the flow:

1) The Client calls a method of the SFSB to lock the data.
2) The SFSB sends data to client.
3) The "human client" modifies (or adds) data using a GUI.
4) The Client calls a method of the SFSB to commit data.

In a first time I thought to start transaction only at point 4),
but I have a problem.
Different clients can modify data only when data are in a "particular state".
If client1 starts modifying data (it can do it) and then client2 starts too and commit 
data before client1, then client1, according the
new "state" of the data, couldn't be allowed to go on modifying.
For this reason I'd like to stop immediately client2.

>To avoid the situation "last one wins", i would just manually keep locking 
>information somewhere that says "another using is editing this data, please try again 
>later". (simply create a table with user/pk information or use a synchronized 
>singleton) 

But in this case I must lock the "user/pk" table instead of
"my data" table: where is the difference ?

>By the way, if you have the entity-reference on the client: client2 will not even be 
>allowed to read the data if client 1 has placed a lock on it (open transaction, 
>default behaviour), so client2 can not even display the data. 

Yes, but I don't want client2 waiting for the end of client1's transaction.
I would like an immediate end of client2 operations.

Many thanks
Moreno

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3844206#3844206

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3844206


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to