This discussion is archived
2 Replies Latest reply: Apr 19, 2013 3:22 PM by 968098 RSS

Entity Framework Concurrency - UpdateException

968098 Newbie
Currently Being Moderated
When running into what should be an OptimisticConcurrencyException in entity framework, i'm getting an update exception as follows:

"A null store-generated value was returned for a non-nullable member 'DateChanged' of type 'FDDT.Model.FeedArray'."

I'm using the DateChanged field as the concurrency tracking field. In entity framework DateChanged has the following properties:
StoreGeneratedPattern: Computed
Concurrency Mode: Fixed

I have a trigger set on this field as follows:

TRIGGER FEED_ARRAY_TRIG_DTCHG before update on FEED_ARRAY for each row
begin
:new.DATE_CHANGED := sysdate;
end;


What am I doing wrong here?

I've tried setting this concurrency tracking field to "Identity" instead, however that causes another error when I run into a concurrency exception and refresh using the client wins option.
  • 1. Re: Entity Framework Concurrency - UpdateException
    968098 Newbie
    Currently Being Moderated
    Here's the SQL generated by EF:

    declare
    "DATE_CHANGED" timestamp;
    begin
    update "FDDT_DATA"."FEED_ARRAY"
    set "MISSION" = :p0
    where (("FEED_ARRAY_ID" = :p1) and ("DATE_CHANGED" = :p2))
    returning
    "DATE_CHANGED" into
    "DATE_CHANGED";
    open :p3 for select
    "DATE_CHANGED" as "DATE_CHANGED" from dual;
    end;
    -- :p0 (dbtype=Decimal, size=0, direction=Input) = 120
    -- :p1 (dbtype=Decimal, size=0, direction=Input) = 32
    -- :p2 (dbtype=Date, size=0, direction=Input) = 11/21/2012 2:48:16 PM
    -- :p3 (dbtype=Object, size=0, direction=Output) = null


    I've found that even though the where clause fails (as it should for concurrency exceptions), Oracle is returning null for DATE_CHANGED. Is there anyway to change this behavior? This seems to be what is causing entity framework to throw the UpdateException: "A null store-generated value was returned for a non-nullable member 'DateChanged' of type 'FDDT.Model.FeedArray'."
  • 2. Re: Entity Framework Concurrency - UpdateException
    968098 Newbie
    Currently Being Moderated
    Anyone?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points