I am using mysql in my java base web app.
I want to lock particular row so that user can read row but can not update and delete.
Row is locked still my code want. that means my code itself unlock the row.
Is it possible in mysql to lock particular row in such manner.
I am not sure what is your use case and why do you want to EXPLICITLY lock a row programmatically. Generally this happens under the hood when you use JDBC/Transaction APIs.
Quoting @Keith Randall from the link shared above by @ Mithun Sasidharan,
This will generally use and Optimistic Locking. What you are interested seems is Pessimistic locking.
In MySQL, one way to do is to use
SELECT FOR UPDATEstatement which will lock the selected rows for you. Please refer to the respective documentation for the usage.