Telerik.OpenAccess.Exceptions.OptimisticVerificationException: Row not found

Thread is closed for posting
2 posts, 0 answers
  1. Eric
    Eric avatar
    1 posts
    Member since:
    May 2011

    Posted 11 Feb 2016 Link to this post


    Telerik OpenAccess throws an error when attempt to update my SQL Table: 

    Telerik.OpenAccess.Exceptions.OptimisticVerificationException: Row not found: GenericOID@e5e5eae8 License Id=3
    UPDATE [users_Licenses] SET [ExpiresOn] = ? WHERE [Id] = ? AND [ExpiresOn] = ?
    Params: [@p0=2016-05-11T12:21:37.3083016+02:00 @p1=3 @p2=2016-05-11T12:21:37.2930000]
       at OpenAccessRuntime.ExceptionWrapper.Throw()
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x, Boolean needsRollback)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
       at LOreal.Mynews.OpenAccess.Services.LicenseService.Update(License instance)
       at LOreal.Mynews.Mobile.WebApi.Helpers.Security.LOrealAuthenticationInspector.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)


    I don't understand why OpenAccess create where clause with filter on [ExpiresOn].

    [ExpiresOn] is not an identity field, ([Id] is)

    SQL query should be

     UPDATE [users_Licenses] SET [ExpiresOn] = ? WHERE [Id] = ?


    can some one help me ?


    thanks in advance


  2. Ady
    Ady avatar
    589 posts

    Posted 16 Feb 2016 Link to this post

    Hi Eric,

     What you see is an OptimisticVerificationException. As the name suggests DataAccess performs certain checks before committing changes to ensure that the object is not changed by some other context/application in the meantime.  There are various Optimistic concurrency modes - 'Changed' is one of them.

    In this mode DataAccess checks all the fields that are modified (in your case 'ExpiresOn' field) with their original value that existed when the object was read. Hence you see the 'ExpiresOn =?' filter. By performing this check we can ensure that the object was not changed in the meantime and that you are not overwriting the change with your change. 
    You can turn off optimistic concurrency checks or select another mode where you can use an explicit optimistic concurrency column (version column) and then DataAccess will only check against this column before committing.

    Do get back in case you need further assistance.

    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Back to Top