I have created an entity model consisting of two tables from an Oracle 9 database using the oradirect.net driver.
The model with assosiations looks like this in the model designer of visual studio 2008:
http://i2.photobucket.com/albums/y8/gub ... odel-1.png
The problems accour when i try to delete a row from the CV_Kurs table. When I try to delete the row either using the delete command of a gridview or by using the DeleteObject and SaveChanges commands I get an OptimisticConcurrencyException containing the following error message:
Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
When i use the DBMonitor for tracing the queries I get the following result:
Code: Select all
Execute: delete from SOS.SO_CV_KURS where ((((KRS_LOEPENR = :p0) and (PRS_LOEPENR = :p1)) and (SBH_REGISTRERTAV = :p2)) and (SBH_ENDRETAV = :p3))
There has been no change in the db when i do the delete, but still i get the exception.
If i try to replace the params with the values in the IN/OUT values from DBMonitor and put the in the query and then executing it in my sql plus tool, the deltete is executed perfectly. But when this query is executed from my application I get the exception.
Is there a possible to remover the assosiation parameters from the where clause in any way? Or have anyone been in this position?
The problem seems to be related to the assosiation parameters. Is it possible that the trim() function is used on the parameters when they are defined for the query? If this is the case it could be a problem for us because we are using the char datatype on the db fields in question:
(SBH_REGISTRERTAV = :p2)) and (SBH_ENDRETAV = :p3))
if the :p2 and the :p3 is trimmed or changed in any other way this can be the source of our problem. Is it possible to avoid this automatic trimming if it is the case?