Column specified more than once in SET clause

6 posts, 0 answers
  1. Chris
    Chris avatar
    40 posts
    Member since:
    Feb 2009

    Posted 30 Jul 2012 Link to this post

    We are using the latest version of OpenAccess. We are using a vertical inheritance strategy in our model. When trying to add an object, we get the following exception:

    Telerik.OpenAccess.RT.sql.SQLException : The column name 'AssetId' is specified more than once in the SET clause. A column cannot be assigned more than one value in the same SET clause. Modify the SET clause to make sure that a column is updated only once. If the SET clause updates columns of a view, then the column name 'AssetId' may appear twice in the view definition. Statement(s) could not be prepared.

    Telerik.OpenAccess.Exceptions.DataStoreException: Insert of '777647279-d9b59293-819d-4835-bdf4-f2674d6f6388' failed: Telerik.OpenAccess.RT.sql.SQLException: The column name 'AssetId' is specified more than once in the SET clause. A column cannot be assigned more than one value in the same SET clause. Modify the SET clause to make sure that a column is updated only once. If the SET clause updates columns of a view, then the column name 'AssetId' may appear twice in the view definition.
    Statement(s) could not be prepared.
       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 [Users] ([AssetId], [EmailAddress], [FirstName], [LastName], [OrganizationId], [AssetId]) VALUES (?, ?, ?, ?, ?, ?)
    (set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: The column name 'AssetId' is specified more than once in the SET clause. A column cannot be assigned more than one value in the same SET clause. Modify the SET clause to make sure that a column is updated only once. If the SET clause updates columns of a view, then the column name 'AssetId' may appear twice in the view definition.
    Statement(s) could not be prepared.
       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) ---> Telerik.OpenAccess.RT.sql.SQLException: The column name 'AssetId' is specified more than once in the SET clause. A column cannot be assigned more than one value in the same SET clause. Modify the SET clause to make sure that a column is updated only once. If the SET clause updates columns of a view, then the column name 'AssetId' may appear twice in the view definition.
    Statement(s) could not be prepared.
       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)
       --- End of inner exception stack trace ---
       at OpenAccessRuntime.ExceptionWrapper.Throw()
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x, Boolean needsRollback)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
       at VirtualOffice.Controllers.UserController.CreateUser(Guid pOrganizationId, String pEmail, String pFirstName, String pLastName, Boolean pCreatePendingConfirmation) in C:\inetpub\wwwroot\VirtualOffice\Common Libraries\VirtualOffice.Controllers\UserController.cs:line 131
       at Controls_ConfirmTokenInvitation.CreateUser(String pEmail, String pPassword, String pFirstName, String pLastName, Boolean pIsShadowUser) in c:\inetpub\wwwroot\VirtualOffice\Web\Portal\Controls\ConfirmToken.ascx.cs:line 112
       at Controls_ConfirmTokenInvitation.OnConfirmInviteClick(Object sender, EventArgs e) in c:\inetpub\wwwroot\VirtualOffice\Web\Portal\Controls\ConfirmToken.ascx.cs:line 96

    We've tried using the association editor to explicitly set all relations, but that doesn't seem to be working. Here is a link the zip containing the RLINQ file.

    https://s3.amazonaws.com/SolidCloud-misc/EntityDiagrams.zip

    Any help would be appreciated.
  2. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 02 Aug 2012 Link to this post

    Hello Chris,

     We reproduced the issue you reported and it looks like a bug on our side when there is a 1:1 association and Vertical inheritance. The 1:1 association between the User and PendingConfirmation objects is the reason for this exception. We are still working on the issue and I will update you later if we could find a workaround for you at the moment. Thanks a lot for reporting this to us. We wil get back to you as soon as we have clearer view on the problem and its possible solutions.

    Kind regards,
    Zoran
    the Telerik team
    Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
  3. Chris
    Chris avatar
    40 posts
    Member since:
    Feb 2009

    Posted 02 Aug 2012 Link to this post

    Thank you so much! We are trying to avoid rolling back to a previous build as much as possible :)
  4. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 07 Aug 2012 Link to this post

    Hello Chris,

     Unfortunately there is no workaround for this bug at the moment, it is a limitation of our 1:1 implementation that one entity can't be in two 1:1 relationships (one created by the vertical inheritance mapping and one normal 1:1 association). We will remove this limitation for our Q3 release though and will even try to push it for as soon as our following internal build.

    All the best,
    Zoran
    the Telerik team
    Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
  5. Steve
    Steve avatar
    1853 posts
    Member since:
    Dec 2008

    Posted 20 Dec 2016 Link to this post

    Just gonna post this here (since it comes up first as a search result), we had this issue just now was related to a fluent mapping

    The problem was we had "userId" as a property column mapping, but "userid" as the association mapping (uppercase letter I)

    configuration.HasProperty(x => x.UserId).IsIdentity().HasFieldName("_userId").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("userId").IsNotNullable().HasColumnType("uniqueidentifier").HasPrecision(0).HasScale(0);
     
    configuration.HasAssociation(x => x.AspnetUser).HasFieldName("_aspnetUser").ToColumn("userid").IsManaged().IsRequired().WithDataAccessKind(DataAccessKind.ReadWrite);

    Fixed to "userId" and it worked

    configuration.HasAssociation(x => x.AspnetUser).HasFieldName("_aspnetUser").ToColumn("userId").IsManaged().IsRequired().WithDataAccessKind(DataAccessKind.ReadWrite);

  6. Dilshod
    Dilshod avatar
    28 posts
    Member since:
    Feb 2012

    Posted 08 Feb in reply to Zoran Link to this post

    Hi,
    In my project I am having the issue of one entity being used in two one to one associations. This is the exception I get:

    An exception of type 'Telerik.OpenAccess.Exceptions.DataStoreException' occurred in Telerik.OpenAccess.Runtime.dll but was not handled in user code
    Additional information: Insert of '2109161148-f15af709-474b-4a43-a61d-12797703b08e' failed: Telerik.OpenAccess.RT.sql.SQLException: The column name 'Id' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.
    Statement(s) could not be prepared. ---> System.Data.SqlClient.SqlException: The column name 'Id' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.
    Statement(s) could not be prepared.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
       at OpenAccessRuntime.CommandWrapper.ExecuteReader(CommandBehavior behavior)
       at Telerik.OpenAccess.Runtime.Logging.LoggingDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteReader()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.CommandImp.ExecuteReader()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute(Nullable`1 commandTimeout)
       --- End of inner exception stack trace ---
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute(Nullable`1 commandTimeout)
       at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute(Nullable`1 commandTimeout)
       at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes, BatchControlInfo batchControl)
    INSERT INTO [Coach] ([Id], [Id]) VALUES (?, ?)
    (set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: The column name 'Id' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.
    Statement(s) could not be prepared. ---> System.Data.SqlClient.SqlException: The column name 'Id' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.
    Statement(s) could not be prepared.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
       at OpenAccessRuntime.CommandWrapper.ExecuteReader(CommandBehavior behavior)
       at Telerik.OpenAccess.Runtime.Logging.LoggingDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteReader()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.CommandImp.ExecuteReader()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute(Nullable`1 commandTimeout)
       --- End of inner exception stack trace ---
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute(Nullable`1 commandTimeout)
       at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute(Nullable`1 commandTimeout)
       at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes, BatchControlInfo batchControl)


    According to the post above the issue had to be fixed in the 3rd Quarter of the 2012. Is the issue still remains? If so is there a workaround?

Back to Top