Cannot refresh Entity - Record does not exist - 5.55.97

Cannot refresh Entity - Record does not exist - 5.55.97

Postby Nahmis » Thu 25 Feb 2010 13:46

Making no changes to our model, etc, we're getting this since upgrading from 5.35.57 to any version above (tested 3 releases including lastest 5.55.97 beta, this is the last version it worked), we're now getting this stack:

Code: Select all
System.InvalidOperationException: Cannot refresh Entity. Record does not exist.
   at Devart.Data.Linq.Provider.DataProvider.GetAutoSyncValues(MetaType type, IDbCommand dbCommand, IList`1 autoSyncFields, IList`1 autoSyncParameters, IList`1 keyFields, IList`1 keyParameters)
   at Devart.Data.Linq.o.a(a A_0, MetaType A_1, h A_2, ModifiedMemberInfo[] A_3, Boolean A_4)
   at Devart.Data.Linq.l.a(i A_0, z A_1, Object A_2, Boolean A_3)
   at Devart.Data.Linq.u.a(l A_0, z A_1, Boolean A_2)
   at Devart.Data.Linq.u.a(DataContext A_0, ConflictMode A_1)
   at Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)


The linq we're running:

Code: Select all
            DB.LogUsers.InsertOnSubmit(new LogUser {
                          Action = action,
                          Ip = ip,
                          Logtime = DateTime.Now,
                          Message = message,
                          Sessionid = sessionID,
                          Success = success,
                          UserName = userName
                       });
            DB.SubmitChanges();


Here's the DBML portion:
Code: Select all
 
   
     
     
     
     
     
     
     
     
   

 


The ID is auto generated via trigger, same way it was in old versions.

This is the first call in the app that inserts anything, we're just record a login timestamp. Any clue as to what's wrong here, some error in our model that doesn't play well with the newer versions? I'm trying to debug the other issue I just posted with Union/Concat...swapping to old versions to make our application work is eating a bit of time here, would appreciate any help. As always, we can zip and send the model if needed. Thanks!
Nahmis
 
Posts: 30
Joined: Mon 13 Jul 2009 21:38

Postby AndreyR » Thu 25 Feb 2010 16:21

Please send me (support * devart * com, subject "LINQ: InsertOnSubmit") the script of the LogUsers table and the model generated using it.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Cannot refresh Entity. Record does not exist.

Postby rick.duarte » Sun 28 Feb 2010 15:06

I'm using version 5.55.97 beta and getting the same error.
I have an insert trigger to insert the sequence. Here is the script of my table:

Code: Select all
CREATE TABLE SCDRD.CONS_DNAM
(
  CD_ID    NUMBER,
  CD_NM    VARCHAR2(150 BYTE),
  CD_SQL   VARCHAR2(4000 BYTE),
  US_MATR  VARCHAR2(6 BYTE)
)
TABLESPACE TS_LMS_MEDIAS_DATA_4M
PCTUSED    0
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          4M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            BUFFER_POOL      DEFAULT
           )
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;


CREATE UNIQUE INDEX SCDRD.PK_CONS_DNAM ON SCDRD.CONS_DNAM
(CD_ID)
LOGGING
TABLESPACE TS_LMS_GRANDES_DATA_128M
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          128M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


CREATE UNIQUE INDEX SCDRD.UK_CONS_DNAM ON SCDRD.CONS_DNAM
(CD_NM)
LOGGING
TABLESPACE TS_LMS_GRANDES_DATA_128M
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          128M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


CREATE OR REPLACE TRIGGER SCDRD."T_SEQ_CD_ID"
  BEFORE INSERT
  ON "SCDRD"."CONS_DNAM"
REFERENCING  OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
SELECT SEQ_CD_ID.nextval INTO :new.CD_ID FROM DUAL;
END;
/


CREATE OR REPLACE TRIGGER SCDRD."T_SEQ_CD_ID_UPD"
  AFTER UPDATE OF "CD_ID"
  ON "SCDRD"."CONS_DNAM"
REFERENCING  OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
RAISE_APPLICATION_ERROR(-20010,'Cannot update column "CD_ID" in table "SCDRD"."CONS_DNAM" as it uses sequence.');
END;
/


ALTER TABLE SCDRD.CONS_DNAM ADD (
  CONSTRAINT PK_CONS_DNAM
PRIMARY KEY
(CD_ID)
    USING INDEX
    TABLESPACE TS_LMS_GRANDES_DATA_128M
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          128M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
               ),
  CONSTRAINT UK_CONS_DNAM
UNIQUE (CD_NM)
    USING INDEX
    TABLESPACE TS_LMS_GRANDES_DATA_128M
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          128M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
               ));

ALTER TABLE SCDRD.CONS_DNAM ADD (
  CONSTRAINT FK_CD_US
FOREIGN KEY (US_MATR)
REFERENCES SCDRD.USU_SIST);


Best regards,

Henrique
rick.duarte
 
Posts: 35
Joined: Fri 23 Jan 2009 23:07
Location: Rio de Janeiro, Brazil

Postby AndreyR » Mon 01 Mar 2010 13:06

Please make sure that you have set the Auto Generated Value proprty to true and the Auto-Sync property to OnInsert.
After performing these steps I have run the following code successfully:
Code: Select all
        db.ConsDnams.InsertOnSubmit(new ConsDnam
        {
          CdNm = "test",
          CdSql = "",
          UsMatr = "hello"
        });
        db.SubmitChanges();
        var q = db.ConsDnams.First();

and have got the generated id in the CdId property.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Same problem

Postby dvine » Wed 10 Mar 2010 10:28

I have the same problem with the current trail version of dotConnect for Oracle. I use a primary key from a sequence with an on insert trigger. When "Auto Generated Value" and "Sync on insert" are enabled, I get the "Cannot refresh Entity. Record does not exist" error. With these two options off, it works. But then I have the problem that .net MVC2 insists on the field being required and giving me trouble with the validation.
Any ideas?
dvine
 
Posts: 1
Joined: Wed 10 Mar 2010 10:00

Postby AndreyR » Thu 11 Mar 2010 12:34

Are you sure you are using 5.60.102 Beta version of dotConnect for Oracle?
I'm still unable to reproduce the problem.
Could you please send me (andreyr * devart * com, subject "EF:AutoincInsert") a small test project illustrating the situation?
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to dotConnect for Oracle