Yes, you got my question quite well.
I've already manage to code a test program where the other thread has to wait until the first is finished ( and releases the row ).
Here is my problem, more specifically :
I use hibernate without a server entity ( ok, it's not the textbook case ). I only have n client instances that connect to the same database.
Before i start thinking about setting a manual lock on some business objects ( = row in one of my tables ), i wanted to know if there is a way to do the following :
> Ask the database if a row is locked ( physically )
> if it's not locked, lock it when retrieving it
> if it's locked, give up ( the user then gets a message like "object is locked, please try later" ) without waiting
The problem is that i can't find a way to make this "test" . Couldn't find any method with a return result, or with an exception thrown in case the object is locked
would really appreciate help on this.
|