Re: [ojb-users] Long Transactions
Brought to you by:
thma
From: Lorenzo N. <ln...@we...> - 2002-06-14 10:37:33
|
> Date: Thu, 13 Jun 2002 19:57:22 +0200 > From: Thomas Mahler <tho...@ho...> > To: Stephan Merker <Ste...@ce...> > Cc: obj...@li... > Subject: Re: [ojb-users] Long Transactions > > Hi Stephan, > I'm not sure about your application scenario. Please give some more > detail on what you want to do! > > Stephan Merker wrote: > > can anybody give me a hint what'ts the right way to perform long > > transactions using OJB with the ODMG API? > > - Client requests an object by sending a request to the server > > - server performs OQL query = 1st transaction > > - object is send to client > 2nd tx must be opened and unmodified object must be locked in WRITE mode > here! > > - client modifies object > > - client sends object back to server > > - server performs update = 2nd transaction > The object must be locked *before* the client can perform modifications! > It's no problem to hold long ODMG transaction, as they do not consume DB > resources (OJB provides a db independent tx isolation mechanism)! I've the same type of question in a specific scenario. A Servlet application (using Tomcat, no EJB infrastructure). Using ODMG. 1) In a client request I retrieve a persistent object using a transaction (opened and immediately closed). This object is put in the user session context. 2) Later (maybe never) in another client request I get the object from session, open a transaction, lock the object, modify it and commit transaction. I'm not sure that this method will not cause problem of concurrent object modification if, for example, another user retrieve the original persistent object between step 1 an 2. In this scenario, Is it mandatory (or advisable)to always use optimistic locking? To add more elements the the scenario, it is possible to have different Servlet application (different VM) using the same persistent source (using OJB in C/S mode). bye Lorenzo WEBPLAN srl v.Civerchio 4 20159 MILANO - ITALY tel. +39-02-69311782 fax. +39-02-60857392 |