You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Joseph Amaya <jo...@yahoo.com> on 2006/10/18 20:46:18 UTC

Re: MSSQL Insert Problem

Hello,

1. My procedure is to run the jdbc Ant task
2. Then I change my schema to autoIncrement="true" for
my Identity table, it already has primayKey="true"
3. Then I run the default task for build-torque
4. I don't set my identity column in my program, but
when I attempt to save I get the TorqueException

"Cannot insert explicit value for identity column in
table 'CONTACTS' when IDENTITY_INSERT is set to OFF."

Andaras Says:

    I have used torque with mssql successfully.
What is not clear to me why you want to insert in the
identity column.
Did you declare the column in the schema as
primaryKey="true" 
autoIncrement="true" ?
If yes than Torque should do the insert into your
CONTACTS table 
correctly and even read the new value
of the column after insert.

Best regards,
Andras.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: MSSQL Insert Problem

Posted by Greg Monroe <Gr...@DukeCE.com>.
In your schema.xml, try setting the defaultIdMethod 
attribute to "native" in the database element.  It 
could be that you're trying to use Torque's DB server
independent key generator and this is setting an 
key value for you. E.g.:

<database name="bookstore" defaultIdMethod="native">
...  

> -----Original Message-----
> From: Joseph Amaya [mailto:joecool_30340@yahoo.com] 
> Sent: Wednesday, October 18, 2006 2:46 PM
> To: torque-user@db.apache.org
> Subject: Re: MSSQL Insert Problem
> 
> Hello,
> 
> 1. My procedure is to run the jdbc Ant task
> 2. Then I change my schema to autoIncrement="true" for
> my Identity table, it already has primayKey="true"
> 3. Then I run the default task for build-torque
> 4. I don't set my identity column in my program, but
> when I attempt to save I get the TorqueException
> 
> "Cannot insert explicit value for identity column in
> table 'CONTACTS' when IDENTITY_INSERT is set to OFF."
> 
> Andaras Says:
> 
>     I have used torque with mssql successfully.
> What is not clear to me why you want to insert in the
> identity column.
> Did you declare the column in the schema as
> primaryKey="true" 
> autoIncrement="true" ?
> If yes than Torque should do the insert into your
> CONTACTS table 
> correctly and even read the new value
> of the column after insert.
> 
> Best regards,
> Andras.
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed.  If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you  please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org