I have 4 AIF service that update multiple table and a same table.
I got the message “Cannot select a record in ChacalFolderControl (ChacalFolderControl).
Deadlock, where one or more users have simultaneously locked the whole table or part of it.” .
The code is :
try
{
select pessimisticlock tNomRepere from chacalfoldercontrol where chacalfoldercontrol.tNomDossier ==
chacalbom.tNomDossier && chacalfoldercontrol.tNomRepere == chacalbom2.tNomRepere;
if (chacalfoldercontrol.tNomRepere != ‘’)
{
ttsBegin;
chacalfoldercontrol.POKComposant = true;
chacalfoldercontrol.update();
ttsCommit;
}
else
{
ttsBegin;
chacalfoldercontrol.tNomDossier = chacalbom.tNomDossier;
chacalfoldercontrol.tNomRepere = chacalbom2.tNomRepere;
chacalfoldercontrol.POKComposant = true;
chacalfoldercontrol.insert();
ttsCommit;
}
}
catch(Exception::Deadlock)
{
retry;
}
But the"retry" seems not work . Is there anyway to avoid this deadlock message ?
Thanks.