Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i explicitly lock a row of a Table

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

How can we implement optimistic locking , i am using Oracle as Database for my Application .

Assume that i am working on a single row of a Table .

Now please tell me how can i explicitly lock this row , so that other simultanoues users insert or update operations are not affected to this particular row .

I am not using any ORM related technology

Please help .


 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Row locking is not optimisitc locking, its pessimistic locking. You do this by using the select...for update syntax in Oracle.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do this by using the select...for update syntax in Oracle.



can you please elobrate this answer .
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Select for update selects a set of data locking it from updates by other transactions (i.e. pessimistic locking). Other than that there is not much extra I can really say. Have a look at the Oracle documentation for select, it has a more complete answer than I am likely to give here.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic