Page 1 of 1

Cannot refresh Entity - Record does not exist - 5.55.97

Posted: Thu 25 Feb 2010 13:46
by Nahmis
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!

Posted: Thu 25 Feb 2010 16:21
by AndreyR
Please send me (support * devart * com, subject "LINQ: InsertOnSubmit") the script of the LogUsers table and the model generated using it.

Cannot refresh Entity. Record does not exist.

Posted: Sun 28 Feb 2010 15:06
by rick.duarte
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

Posted: Mon 01 Mar 2010 13:06
by AndreyR
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.

Same problem

Posted: Wed 10 Mar 2010 10:28
by dvine
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?

Posted: Thu 11 Mar 2010 12:34
by AndreyR
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?