Concurrency problems

Concurrency problems

Postby gegge10 » Tue 14 Oct 2008 07:50

I have a little problem maybe someone could help me with, this is the scenario:

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))


with these params:
Image

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?
gegge10
 
Posts: 2
Joined: Tue 14 Oct 2008 07:27

Postby gegge10 » Tue 14 Oct 2008 12:30

Our conlusion on the isssue is that if we try to delete a row and have a foreign key to an related table that is of the datatype CHAR. This will automatic lead to that this assosiated property is inserted into the where clause, but the value that is compared is set to datatype varchar an/or trimmed. This will cause the delete statement to fail bescause the comparison of the fields in the where clause fails.

Therfor we need to either remover the assosiated properties from the where clause or prevent the conversion/trimming of the paramters that is transferred to the where clause.

Does someone know how to achive either of these solutions?
gegge10
 
Posts: 2
Joined: Tue 14 Oct 2008 07:27

Postby Shalex » Wed 15 Oct 2008 11:57

Please send me (alexsh at devart.com) a small test project and the script that creates the database objects and fills them with data. We will try to reproduce the problem.
Shalex
Devart Team
 
Posts: 7460
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle