You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "DiCorpo, Phillip" <ph...@vontu.com> on 2007/03/06 20:33:08 UTC

lock() and tryLock() behavior in OJB 1.0.4

I was wondering what the behavior was when obtaining a WRITE lock on an
object using the ODMG APIs in OJB 1.0.4.  I expected that this call
would reload the object from the database if there had been any changes
commited before obtaining the WRITE lock.  This doesn't seem to be the
case in the code I'm running, but maybe there's something wrong in my
configuration.
 
I'm using LockManagerInMemoryImpl, isolation level for all objects are
set to uncommited-read, and LockAssociations=READ.   Is there something
else I might be missing here?
 
Thanks,
Phil

Re: lock() and tryLock() behavior in OJB 1.0.4

Posted by Armin Waibel <ar...@apache.org>.
Hi Phil,

DiCorpo, Phillip wrote:
> I was wondering what the behavior was when obtaining a WRITE lock on an
> object using the ODMG APIs in OJB 1.0.4.  I expected that this call
> would reload the object from the database if there had been any changes
> commited before obtaining the WRITE lock. 

This would be a nice feature. But sorry this isn't the current behavior. 
If you lock an object OJB doesn't compare it with the database (or with 
an invisible object version field).
You can lookup the object by PK after the WRITE-lock using the PB-api 
within the odmg-api.
http://db.apache.org/ojb/docu/guides/odmg-guide.html#I+don%27t+like+OQL%2C+can+I+use+the+PersistenceBroker+Queries+within+ODMG
http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key
In this case it's guaranteed that you will get the latest version from DB.

regards,
Armin

> This doesn't seem to be the
> case in the code I'm running, but maybe there's something wrong in my
> configuration.
>  
> I'm using LockManagerInMemoryImpl, isolation level for all objects are
> set to uncommited-read, and LockAssociations=READ.   Is there something
> else I might be missing here?
>  
> Thanks,
> Phil
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org