Page 1 of 1

Problem with autogenerated PK

Posted: Tue 26 Oct 2010 21:15
by jpla2005
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?

Posted: Wed 27 Oct 2010 16:16
by AndreyR
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).

Posted: Wed 27 Oct 2010 19:43
by jpla2005
All right, that's the problem. The VS Designer only sets the value in CSDL, not in SSDL.

Thanks again

Posted: Tue 09 Nov 2010 18:53
by curelom
Could you provide an example of this. I can't find it in my file.

Posted: Wed 10 Nov 2010 17:42
by Shalex
curelom, please refer to http://www.devart.com/forums/viewtopic.php?t=18620. There is a reference to a detailed example in that thread.