Description:
I have one table in db say Table1
. having only one column AppNo(numeric)
and only single row, and current val
This is not very well documented or easy to find, but what you want is a Transaction that wraps your find query which uses a lock option to turn it into a SELECT FOR UPDATE
statement.
The find query with the lock
option will lock the row (you don't need to lock the entire table) and because you are using a transaction, the action will either be committed or rolled back depending on whether or not your instance holds the lock.
You will want to adapt the code found in these examples for your use.