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

Armin Waibel <[email protected]>
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.