none
ODP.net 4.112.3.0 + entity framework 4.4 Identity Column Raw(16) conversion RRS feed

  • Question

  • Entity Framework is throwing exception during insert into oracle table in which Raw(16) is Primary key. It is mapped as
    raw (maxlength = 16) in SSDL and Guid in CSDL files.

    Tried few possible combinations as changing raw to guid in SSDL but in vain. I have also checked that StoreGeneratedPattern = Identity is set in SSDL and CSDL.

    application is working fine when Primary key is changed to Sequence in Oracle table.

    Question is - how do we handle Raw(16) datatype in Entity Framework? is there any workaround for guid to use as default value in primary key column?

    Here is the stack trace below:


    System.Data.Entity.Infrastructure.DbUpdateException was unhandled by user code
    Message=An error occurred while updating the entries. See the inner exception for details.
    Source=EntityFramework
    StackTrace:
    at System.Data.Entity.Internal.InternalContext.SaveChanges()
    at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
    at System.Data.Entity.DbContext.SaveChanges()
    at PerfWA.Default.EF_Click(Object sender, EventArgs e) in E:\StockExceptions\Projects\PerfWA\Default.aspx.cs:line 70
    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    InnerException: System.Data.UpdateException
    Message=An error occurred while updating the entries. See the inner exception for details.
    Source=System.Data.Entity
    StackTrace:
    at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
    at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
    at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
    at System.Data.Entity.Internal.InternalContext.SaveChanges()
    InnerException: Oracle.DataAccess.Client.OracleException
    Message=ORA-00932: inconsistent datatypes: expected BLOB got BINARY
    ORA-06512: at line 5
    Source=Oracle Data Provider for .NET
    ErrorCode=-2147467259
    DataSource=Test
    Number=932
    Procedure=""
    StackTrace:
    at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
    at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)
    at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
    at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues)
    at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
    InnerException:

    Tuesday, November 6, 2012 9:33 AM

All replies