SaveEntity throws ORMConcurrencyException when updating entity

Posts   
 
    
Brunogr
User
Posts: 5
Joined: 30-Mar-2020
# Posted on: 23-Apr-2020 21:46:35   

Hi all, my setup is llblgenpro with mysql and the package versions below:

SD.LLBLGen.Pro v5.2.1 (all packages) Mysql.Data v8.0.19 Mysql.Web v8.0.19 dotConnect.Express.for.MySQL v8.17.1583

I've recently updated Mysql.Data and dotConnect, but i've maintened the same version for llblgenpro.

After this, i don't know it is related, but i was getting the ORMConcurrencyException below on some points of the software when i use SaveEntity to update (i do fetch the entity before saving it). On some points, that does update, i've changed SaveEntity for UpdateEntitiesDirectly, and with UpdateEntitiesDirectly i don't get the exception, but this method doesn't update or save nested classes as SaveEntity used to do.

So, anyone knows why SaveEntity is throwing this exception? I want to rollback some points to use SaveEntity again, but i need a solution to this exception.

Thanks all.

SD.LLBLGen.Pro.ORMSupportClasses.ORMConcurrencyException: During a save action an entity's update action failed. The entity which failed is enclosed.
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.PerformPostEntitySaveActions(Boolean insertActions, ActionQueueElement`1 element, EntityBase2 entityToSave, Boolean saveSucceeded)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.PersistQueue(List`1 queueToPersist, Boolean insertActions)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave, IPredicateExpression updateRestriction, Boolean recurse)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>n__18(IEntity2 entityToSave, Boolean refetchAfterSave, IPredicateExpression updateRestriction, Boolean recurse)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>c__DisplayClass19_0.<SaveEntity>b__0()
   at SD.LLBLGen.Pro.ORMSupportClasses.RecoveryStrategyBase.Execute[TResult](Func`1 toExecute)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteWithActiveRecoveryStrategy[T](Func`1 toExecute)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave, IPredicateExpression updateRestriction, Boolean recurse)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave)
   at Twyne.Domain.Repository.DoAction(Action`1 action) in C:\projects\twyne\libraries\Twyne.Domain\Repository\Repository.cs:line 48
   at Twyne.Domain.Repository.Save[T](T Tosave, Boolean Toload) in C:\projects\twyne\libraries\Twyne.Domain\Repository\Repository.cs:line 132
   at twyne.admin.Controllers.PubCampaignsController.SetValidationStatus(Int32 campaignId, String ValidationType, Boolean SetActive, Boolean IsRulesFilters) in C:\projects\twyne\twyne.admin.v2\Controllers\PubCampaignsController.cs:line 1817
Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 24-Apr-2020 00:30:03   

Is there a Concurrency Predicate being used on this specific transaction?

Brunogr
User
Posts: 5
Joined: 30-Mar-2020
# Posted on: 24-Apr-2020 15:49:06   

Walaa wrote:

Is there a Concurrency Predicate being used on this specific transaction?

it is not, i've never set an custom Concurrency Predicate. It used to work before, never had these issues.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 24-Apr-2020 17:04:39   

it reports this error if the # of affected rows is 0 (so the update didn't do anything). Could you check which query is executed on the database and which parameter values are passed? (E.g. with orm profiler, it's free for subscription owners)

Frans Bouma | Lead developer LLBLGen Pro