Problem with autogenerated PK

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 autogenerated PK

Post by jpla2005 » Tue 26 Oct 2010 21:15

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?

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

Post by AndreyR » Wed 27 Oct 2010 16:16

Please make sure that you have changed the StoredGeneratedPattern attribute in the Store part of the model.
It is a known issue with VS EDM Designer, it does not make any change to the StoreGeneratedPattern attribute, in case it is changed in design time (only the annotation:StoreGeneratedPattern conceptual attribute is modified).

jpla2005
Posts: 5
Joined: Wed 28 Apr 2010 16:09

Post by jpla2005 » Wed 27 Oct 2010 19:43

All right, that's the problem. The VS Designer only sets the value in CSDL, not in SSDL.

Thanks again

curelom
Posts: 19
Joined: Wed 17 Feb 2010 21:10

Post by curelom » Tue 09 Nov 2010 18:53

Could you provide an example of this. I can't find it in my file.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 10 Nov 2010 17:42

curelom, please refer to http://www.devart.com/forums/viewtopic.php?t=18620. There is a reference to a detailed example in that thread.

Post Reply