This question is locked. New answers and comments are not allowed.
Hi,
I'm very new to this OpenAccess. I tried to do some reverse mapping using the wizard. And it works OK :)
However, while trying to update a record which has property Contact object, the following error message is shown:
Insert of '1794434107-b9019f15-9a1a-42bb-bdf2-5965bc399b30' failed: Telerik.OpenAccess.RT.sql.SQLException: Violation of PRIMARY KEY constraint 'PK_Contact'. Cannot insert duplicate key in object 'dbo.Contact'.
The statement has been terminated.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
INSERT INTO [Contact] ([ContactID], [CreationDate], [DOB], [EFY], [EmailAddress], [Fax], [FirstName], [HomePhone], [LastEditDate], [LastName], [MailOptOut], [MiddleName], [Mobile], [SpamOptOut], [Submitted], [TEMP_ConsID], [TEMP_EnjoID], [Title], [WorkPhone]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
(set event logging to all to see parameter values)
Based on the error description, it looks like it tries to insert the Contact object. Is there something that I miss? Please kindly advice
Following is the code snippet which being used to update the record:
public string UpdateEntity<T>(T entity)
{
try
{
string entityId = this.GetEntityId<T>(entity);
T existingObject = this.ReadEntity<T>(entityId);
this.ExecuteCopy(entity, existingObject);
this.scope.Transaction.Commit();
return entityId;
}
catch (Telerik.OpenAccess.OpenAccessException ex)
{
this.RollBackTransaction(this.scope);
throw ex;
}
}
Regards,
Teguh Suryadi
I'm very new to this OpenAccess. I tried to do some reverse mapping using the wizard. And it works OK :)
However, while trying to update a record which has property Contact object, the following error message is shown:
Insert of '1794434107-b9019f15-9a1a-42bb-bdf2-5965bc399b30' failed: Telerik.OpenAccess.RT.sql.SQLException: Violation of PRIMARY KEY constraint 'PK_Contact'. Cannot insert duplicate key in object 'dbo.Contact'.
The statement has been terminated.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
INSERT INTO [Contact] ([ContactID], [CreationDate], [DOB], [EFY], [EmailAddress], [Fax], [FirstName], [HomePhone], [LastEditDate], [LastName], [MailOptOut], [MiddleName], [Mobile], [SpamOptOut], [Submitted], [TEMP_ConsID], [TEMP_EnjoID], [Title], [WorkPhone]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
(set event logging to all to see parameter values)
Based on the error description, it looks like it tries to insert the Contact object. Is there something that I miss? Please kindly advice
Following is the code snippet which being used to update the record:
public string UpdateEntity<T>(T entity)
{
try
{
string entityId = this.GetEntityId<T>(entity);
T existingObject = this.ReadEntity<T>(entityId);
this.ExecuteCopy(entity, existingObject);
this.scope.Transaction.Commit();
return entityId;
}
catch (Telerik.OpenAccess.OpenAccessException ex)
{
this.RollBackTransaction(this.scope);
throw ex;
}
}
Regards,
Teguh Suryadi