I am executing the below MySQL UPDATE query,
Query query = em.createNamedQuery("User.unSubscribeUserByEmailId");
query.setParameter("emailId", emailId);
query.executeUpdate();
Whereas, User.unSubscribeUserByEmailId
says,
query = "UPDATE User u set u.unsubscribed=1,u.unsubscribedReason='unsubscribed' WHERE u.emailId = :emailId"),
One more thing I want to mention here is that the "User" table is the table frequently used/hit by other tables also. Also I'm not using a large chunk of emailId's updating at once, instead we have a foreach loop where single Id's are updating the unsubscription status like,
for(String emailId : existingEmailIds.getListItems()){
unsubscribeEmailId(emailId, whitelistDomains, blacklistDomains);
}
Don't understand why am I getting "lock wait timeout exceeded" exception.