Problem with 0...1 to many relation

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
jpla2005
Posts: 5
Joined: Wed 28 Apr 2010 16:09

Problem with 0...1 to many relation

Post by jpla2005 » Tue 14 Dec 2010 16:36

Hi all,

I'm having troubles with the dotConnect for Oracle 5.60. I have the following scenario:

Person and Property tables. The first one has a 0...1 to many relation with the second one. So, I created an instance of Person, add each one of the properties obtained from database and I tried inserting the person object and then I got the following exception:


The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: A referential integrity constraint violation occurred: The property values that define the referential constraints are not consistent between principal and dependent objects in the relationship.


The problem seem to be while trying to update the Property setting the PersonId fk, because the Person entity was inserted successfully but it key isn't saved in the Property table.

I changed my code and tried with two separated queries. One inserting the person and a second updating it by setting all the properties (in table Property) and it works fine.

By the other hand, I created the same example using Microsoft SQL Server 2008 r2 and all works fine.

Regards

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 15 Dec 2010 10:02

Could you please send us (support * devart * com, subject "EF: ObjectContext integrity") a small test project illustrating the issue?

Post Reply