Skip to Content
0
Jan 16, 2008 at 11:18 AM

CAFLock Exception for Update method of CAF Entity Service

28 Views

Hi All

I am using Adaptive web service model for my CAF Application Services , I have created Access methods (CRUD)for my Entity service in Application Service which is exposed as web service I am able to call n execute all the methods sucessfully except for update method for which I am gettimg CAFLockException

note that in create method I have following lines of code

( retvalue is of Entity Service type , systemCode is primary key on table others are non primary keys)

retValue = getSystemCodeService().create(systemCode);

retValue.setBusAct(busAct);

retValue.setCurrency(currency);

retValue.setDocType(docType);

retValue.setHeaderText(headerText);

retValue.setUserName(userName);

getSystemCodeService().update(retValue);

here record gets created sucessfully and update which is last line in above code also works fine

but when i seprately test update method in CAF Application Service exposed as web service I get CAFLockexception

here's what update method contains

getSystemCodeService().update(newobj);

while making call to this method I have ensured that I am supplying Key and SystemCode( which is custom primary key on table )

it seems when I used update in my create method at that time row got locked coz I tried to cross check with below code in my create method

retValue = getSystemCodeService().create(systemCode);

retValue.setBusAct(busAct);

retValue.setCurrency(currency);

retValue.setDocType(docType);

retValue.setHeaderText(headerText);

retValue.setUserName(userName);

getSystemCodeService().update(retValue);

getSystemCodeService().readSystemCodeRecord(new QueryFilter("dummy"));

retValue.setUserName("NEWUPDATED");

getSystemCodeService().update(retValue);

and it works only when I read some other record in table and again call update method i do not get Lock exception

if last four lines are changed to

getSystemCodeService().update(retValue);*

retValue.setUserName("NEWUPDATED");

getSystemCodeService().update(retValue);

I again get lock exception

looking at above pattern I tried adding this code in my CAF Application Service update method

getSystemCodeService().readSystemCodeRecord(new QueryFilter("dummy"));

getSystemCodeService().update(newobj);

ie do dummy read on some other record to remove lock on the record which i want to update , but did not suceed in that

please help me to update the record second time , can u tell me how to unlock this row or is there anything I am doing wrong

Thanks in Advance

Asif