Concurrency Exception

Posts   
 
    
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 10-Aug-2018 03:25:05   

I have a situation whereby I am running an update on an entity but I am getting an ORM concurrency exception

In another post on this forum I read that you get these errors if a) the entity is deleted and does not exists or b) the update results in no change being made

I know the entity exists so my situation is b)

I notice on one particular very simple example the generated SQL is

UPDATE `service_visit` SET `NonSignOffNotified`=1 WHERE ( `service_visit`.`ServiceVisitId` = "bfa74512-712b-4f39-8101-73abb473a1ed")

Which runs fine on MySql manually, but since NonSignOffNotified is already 1 nothing is actually changed i.e. in My SQL the number of affected rows is 0, matched is 1 , changed is 0 and warnings is 0. I assume this then triggers the error

In my particular circumstances I need to be able to set some properties on an entity (that may or may not be different from what is in the database) and then persist the changes without causing the exception if nothing is actually changed.

Is there a property on the entity or something that I can check before I attempt to update the database (so I can not bother persisting) or some other way to prevent the exception from being triggered. I note that IsDirty is set to true on the entity above, so I cannot use that.

For this project I am using Version 4.2 of LLBL Gen

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Aug-2018 10:08:21   
David Elizondo | LLBLGen Support Team