Unnecessary Timestamp Update on Non-changed Entities
Posted: Wed 25 May 2011 17:13
Hi we are seeing an issue when using Optimistic Concurreny with EF / Devart Oracle Connect.
Our DB structure is this
ContractVersion Table (Master Table)
- Counterparty Table (related to ContractVersion)
- Delivery Table (related to ContractVersion)
Which Translates into the following DTO's (we are using POCO STE's)
ContractVersion containing
- List of 1..N Counterparties
- List of 1..N Deliveries
All 3 tables have a timestamp column. The Timestamp for each is updated with a trigger on the Oracle DB. We currently have (and I have checked the xml in the .edml/.edmx) the Timestamp columns set to StoreGeneratedPattern=Computed and the ConcurrencyMode=Fixed.
When we change all the entities Or the parent Entity (ie the ContractVersion), the Optimistic Concurrency works perfectly. However we have a specific case that we cannot figure out.
If we make a change to the Delivery Entity or the Counterparty Entity, the resulting Update commands for these tables are generated correctly. However, in addition we also have an additional Update of the ContractVersion table, that updates nothing but the Timestamp column (See below for the query picked up via EF Profiler). We have validated that the ContractVersion Entity has no changes (ie its not in a modified/changed state), so are confused as to why this update is being called.
Anybody got any ideas?
The additional command, which is called before the actual changes are executed is as follows -
DECLARE
updatedRowid ROWID;
BEGIN
UPDATE
CONTRACT_VERSION
SET TIMESTAMP = TIMESTAMP
WHERE CONTRACT_VERSION_ID = 20 /* @p0 */ AND
TIMESTAMP = '25/05/2011 17:33:21 +01:00' /* @p1 */
RETURNING ROWID INTO updatedRowid;
OPEN '' /* @outParameter */ FOR SELECT
TIMESTAMP
FROM CONTRACT_VERSION
WHERE ROWID = updatedRowid;
END;
Our DB structure is this
ContractVersion Table (Master Table)
- Counterparty Table (related to ContractVersion)
- Delivery Table (related to ContractVersion)
Which Translates into the following DTO's (we are using POCO STE's)
ContractVersion containing
- List of 1..N Counterparties
- List of 1..N Deliveries
All 3 tables have a timestamp column. The Timestamp for each is updated with a trigger on the Oracle DB. We currently have (and I have checked the xml in the .edml/.edmx) the Timestamp columns set to StoreGeneratedPattern=Computed and the ConcurrencyMode=Fixed.
When we change all the entities Or the parent Entity (ie the ContractVersion), the Optimistic Concurrency works perfectly. However we have a specific case that we cannot figure out.
If we make a change to the Delivery Entity or the Counterparty Entity, the resulting Update commands for these tables are generated correctly. However, in addition we also have an additional Update of the ContractVersion table, that updates nothing but the Timestamp column (See below for the query picked up via EF Profiler). We have validated that the ContractVersion Entity has no changes (ie its not in a modified/changed state), so are confused as to why this update is being called.
Anybody got any ideas?
The additional command, which is called before the actual changes are executed is as follows -
DECLARE
updatedRowid ROWID;
BEGIN
UPDATE
CONTRACT_VERSION
SET TIMESTAMP = TIMESTAMP
WHERE CONTRACT_VERSION_ID = 20 /* @p0 */ AND
TIMESTAMP = '25/05/2011 17:33:21 +01:00' /* @p1 */
RETURNING ROWID INTO updatedRowid;
OPEN '' /* @outParameter */ FOR SELECT
TIMESTAMP
FROM CONTRACT_VERSION
WHERE ROWID = updatedRowid;
END;