Problem with a sequence generated id in Oracle

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
labate
Posts: 48
Joined: Tue 17 Jan 2006 13:57
Location: Switzerland, Sion

Problem with a sequence generated id in Oracle

Post by labate » Thu 28 Oct 2010 08:08

Hello devart,

When I add a new entity object into Oracle, the record is created. However I noticed the entity is not refreshed with the new ID generated on the server.

Code: Select all

 
using (MyEf4Entities ctx = new MyEf4Entities())
{
    var person = new Person
        {
        Name = "MyName", 
        };

    ctx.Persons.AddObject(person);
    ctx.SaveChanges();
}
Before the SaveChanges(), PersonId is 0, the state is Added and the entitykey is set to temporary is true.
After the SaveChanges(), PersonIs is still 0, the state is Unmodified and the entitykey is set to temporary is false.

Of course, PersonId is the key and its property StoreGeneratedPattern is set to true.
A trigger exist:

Code: Select all

CREATE OR REPLACE TRIGGER "PHX5"."TRG_BEFORE_INSERT_PERSON"
before insert on person
for each row
begin
select mspak.seq_personid.nextval into :new.personid from dual;
end;
This problem seems very trivial. Is there something I missed?

We work with dotConnect for Oracle Pro, 5.70.152.0, Oracle 11g
Thanks.

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

Post by AndreyR » Thu 28 Oct 2010 13:06

I have made a simple test and everything succeeded.
Could you please send us (support * devart * com, subject "EF4 StoreGeneratedPattern") a small test project illustrating the situation?

Post Reply