db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øystein Grøvlen <Oystein.Grov...@Sun.COM>
Subject Re: Row level locking
Date Mon, 14 May 2007 06:15:54 GMT
Umakanth Srinivasan wrote:
> Mode: Embeded 
> I was trying to generate sequence keys with my code, and I faced issue in
> row level locking
> First,
> I locked my sequence keys holding table ( a table which says what is the
> next key for a specific table), with the "FOR UPDATE OF <column name>"
> keyword. 
> Second,
> Then updating the table by incrementing the existing value, and getting the
> updated value.
> With print traces in my code I found that when a select query locks a
> particular row, and then before the next update, another connection is
> allowed to make a select on the query and get the same value.
> Am I missing anything here.

Specifying FOR UPDATE will not by itself cause locks to be held after 
the query is completed.  In order to achieve that you will have to set 
the isolation level to REPEATABLE READ or SERIALIZABLE.


View raw message