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
Search found 5 matches
- Tue 14 Dec 2010 16:36
- Forum: dotConnect for Oracle
- Topic: Problem with 0...1 to many relation
- Replies: 1
- Views: 3137
- Wed 27 Oct 2010 19:43
- Forum: dotConnect for Oracle
- Topic: Problem with autogenerated PK
- Replies: 4
- Views: 1832
- Tue 26 Oct 2010 21:15
- Forum: dotConnect for Oracle
- Topic: Problem with autogenerated PK
- Replies: 4
- Views: 1832
Problem with autogenerated PK
Hi all,
I have a problem again with autogenerated pk in Oracle. In my table I have a id field that is a varchar(32) and the default value is set to RAWTOHEX(SYS_GUID()).
In the other hand, In my model, I have this column mapped to an Id property as a not null string. Besides I selected the generation pattern as Identity.
When I try to insert a new entity in a database I get the error "ORA-01400", telling that I can't insert passing a null value in the pk property. I dont know why the generated sql statement include the pk, and this is the cause of the error.
I am using VS2010 with EF 4 and DotConnect for Oracle 5.60. Please, can you help me?
I have a problem again with autogenerated pk in Oracle. In my table I have a id field that is a varchar(32) and the default value is set to RAWTOHEX(SYS_GUID()).
In the other hand, In my model, I have this column mapped to an Id property as a not null string. Besides I selected the generation pattern as Identity.
When I try to insert a new entity in a database I get the error "ORA-01400", telling that I can't insert passing a null value in the pk property. I dont know why the generated sql statement include the pk, and this is the cause of the error.
I am using VS2010 with EF 4 and DotConnect for Oracle 5.60. Please, can you help me?
- Thu 29 Apr 2010 16:54
- Forum: dotConnect for Oracle
- Topic: Autogenerated GUID Primary Key
- Replies: 2
- Views: 1874
- Wed 28 Apr 2010 16:19
- Forum: dotConnect for Oracle
- Topic: Autogenerated GUID Primary Key
- Replies: 2
- Views: 1874
Autogenerated GUID Primary Key
Hi all
I'm facing problems working with GUID autogenerated primary keys. I've a table with a Raw(16) primary key wich value is autogenerated using SYS_GUID() oracle function. Th problems is when I insert the first value (without setting the id value for the entity) this id takes a value "00000000000000000000000000000000" and of course, the second call throws an exception because a primary key violation. The problem seems that EF does not recognize this is a autogenerated value and passes the default value of this type when I don't provide another one. Please, how can I solve this problem?
thanks
I'm facing problems working with GUID autogenerated primary keys. I've a table with a Raw(16) primary key wich value is autogenerated using SYS_GUID() oracle function. Th problems is when I insert the first value (without setting the id value for the entity) this id takes a value "00000000000000000000000000000000" and of course, the second call throws an exception because a primary key violation. The problem seems that EF does not recognize this is a autogenerated value and passes the default value of this type when I don't provide another one. Please, how can I solve this problem?
thanks