I am selecting an id from table and then adding them in List. -> Select ID from TABLE where X='A' ( just an example)
Once done, in next method i am doing jdbcTemplate.batchUpdate(sql, listArgs, type_update)
Here "listArgs" is the Id which i have in list in first method. batchUpdate is updating status of ID from one value to another.
I need to lock the ID which i have added in List while performing select query because some other application can also access or use that ID.
Lock is required because while my application is trying to batchUpdate the status of ID to some other value parallely some other application has already taken that ID and has change some other status.
Any advice would be helpful.
Application is in spring boot.. I tried write-lock spring but that didn't worked for batchUpdate.