I'm getting an Ora-060 'Deadlock' error in the following situation:
A incoming WCF call is handled in a typical UnitOfWork pattern with a commit at the end of the call. At a certain point in this operation when we have modifications on the entity, we call context.SaveChanges(acceptchanges) to flush all changes to the DB. Then, we modify again those entities and we reach the end of our UnitOfWork and we do the final commit. There we get the deadlock error.
The last sql statement sent to the database is 'UPDATE PEOPLE SET ID = ID WHERE ID=:p0 AND VERSION=:p1'
* Why does Devart/EF generate this statement? I thought this should be avoided at all times.
* According to our DBA updating the PK locks child tables of the PEOPLE table, which is the reason of the deadlock. (obviously, other threads are doing the same stuff in parallel)
I have a workaround: after calling SaveChanges(), I set the people entity's state to modified => EF generates a true update statement (updating all fields but the PK field).
Why does EF updates my PK with the same value?
Re: Why does EF updates my PK with the same value?
There is the possibility to turn off generation of fake updates for parent entities:
The OracleEntityProviderConfig class is available in the %ProgramFiles%\Devart\dotConnect\Oracle\Entity\EF4\Devart.Data.Oracle.Entity.dll assembly.
For more information, refer to http://www.devart.com/dotconnect/oracle ... ation.html.
Code: Select all
var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
config.DmlOptions.EmptyUpdates = false;
For more information, refer to http://www.devart.com/dotconnect/oracle ... ation.html.