If you manually set the primary key value with Transfer of a new object, it
assumes you know what you are doing, and attempts to insert that value into
the database as the Primary key.

I can only assume somewhere in your code, you are setting the Id value of
your object, and it's getting passed down the line.

Mark

On Thu, Apr 1, 2010 at 4:37 AM, Elliott Sprehn <espr...@gmail.com> wrote:

> I'm seeing this error, though very infrequently.
>
> Detail  [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert
> explicit value for identity column in table 'SurveyQuestionAnswer'
> when IDENTITY_INSERT is set to OFF.
> Tag Context
> D:\Inetpub\cflibrary\transfer\com\sql\QueryExecution.cfc (82)
> D:\Inetpub\cflibrary\transfer\com\sql\TransferInserter.cfc (376)
> D:\Inetpub\cflibrary\transfer\com\sql\TransferInserter.cfc (137)
> D:\Inetpub\cflibrary\transfer\com\sql\TransferInserter.cfc (66)
> D:\Inetpub\cflibrary\transfer\com\sql\transaction\Transaction.cfc
> (210)
> D:\Inetpub\cflibrary\transfer\com\sql\transaction\Transaction.cfc (89)
> D:\Inetpub\cflibrary\transfer\com\sql\TransferInserter.cfc (50)
> D:\Inetpub\cflibrary\transfer\com\sql\SQLManager.cfc (62)
> D:\Inetpub\cflibrary\transfer\com\Transfer.cfc (199)
> D:\Inetpub\cflibrary\transfer\com\Transfer.cfc (182)
>
> Transfer is generating the SQL:
> INSERT INTO
> SurveyQuestionAnswer(text,comment,selected,filePath,surveyQuestionId,Id)
> VALUES ( (param 1) , (param 2) , (param 3) , (param 4) , (param 5) ,
> (param 6) )
>
> (param 1) = [type='IN', class='java.lang.String', value='',
> sqltype='cf_sql_varchar'] , (param 2) = [type='IN',
> class='java.lang.String', value='', sqltype='cf_sql_varchar'] , (param
> 3) = [type='IN', class='java.lang.Boolean', value='false',
> sqltype='cf_sql_bit'] , (param 4) = [type='IN',
> class='java.lang.String', value='', sqltype='cf_sql_varchar'] , (param
> 5) = [type='IN', class='java.lang.Double', value='3.0',
> sqltype='cf_sql_float'] , (param 6) = [type='IN',
> class='java.lang.Double', value='6654.0', sqltype='cf_sql_float']
>
> Which doesn't make sense since Id is the primary key. Why would
> Transfer be manually inserting the primary key? This record does exist
> in the database though. It seems almost like Transfer is actually
> doing an INSERT on an object that already exists in the database.
>
> Here's the XML:
> <object name="QuestionAnswer" table="SurveyQuestionAnswer"
>        decorator="com.stellr.beans.survey.QuestionAnswer">
>
>        <id name="Id" type="numeric"/>
>        <property name="text" type="string"/>
>        <property name="comment" type="string"/>
>        <property name="selected" type="boolean"/>
>        <property name="filePath" type="string"/>
>
>        <manytomany name="Choice" table="SurveyQuestionAnswerChoice">
>                <link to="survey.QuestionAnswer"
> column="surveyQuestionAnswerId"/>
>                <link to="survey.QuestionChoice"
> column="surveyQuestionChoiceId"/>
>                <collection type="array">
>                        <order property="Id" order="asc"/>
>                </collection>
>        </manytomany>
>        <manytoone name="Question">
>                <link to="survey.Question" column="surveyQuestionId"/>
>        </manytoone>
> </object>
>
> The full file is here:
> http://svn.riaforge.org/saa/trunk/library/com/stellr/config/transfer/transfer.xml
>
> --
> Before posting questions to the group please read:
>
> http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer
>
> Try out the new Transfer ORM Custom Google Search:
> http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8
>
> You received this message because you are subscribed to the Google Groups
> "transfer-dev" group.
> To post to this group, send email to transfer-dev@googlegroups.com
> To unsubscribe from this group, send email to
> transfer-dev+unsubscr...@googlegroups.com<transfer-dev%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/transfer-dev?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>



-- 
E: mark.man...@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

Hands-on ColdFusion ORM Training @ cf.Objective() 2010
www.ColdFusionOrmTraining.com/

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en

Reply via email to