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:
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
:new.DATE_CHANGED := sysdate;
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.
Here's the SQL generated by EF:
set "MISSION" = :p0
where (("FEED_ARRAY_ID" = :p1) and ("DATE_CHANGED" = :p2))
open :p3 for select
"DATE_CHANGED" as "DATE_CHANGED" from dual;
-- :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'."