Hi,
Is it possible to make a foreign key as primary key in torque? Because
I had following SQLException when inserting records.

--------------
java.sql.SQLException: Duplicate key or integrity constraint violation
message from server: "
Cannot add or update a child row: a foreign key constraint fails"
--------------

Here's the schema and I'm using MySQL 4.1:

--------------
    <table name="vehicle" description="vehicle's info" idMethod="native">
        <column name="id" primaryKey="true" required="true"
autoIncrement="true" type="INTEGER"/>
        <column name="owner_id" primaryKey="true" required="true"
type="INTEGER"/>
        <column name="name" type="VARCHAR"/>
        <foreign-key foreignTable="owner">
            <reference foreign="id" local="owner_id"/>
        </foreign-key>
    </table>

    <table name="owner" description="owner's info" idMethod="native">
         <column name="id" primaryKey="true" required="true"
autoIncrement="true" type="INTEGER"/>
        <column name="name" type="VARCHAR"/>
    </table>
--------------



Thank you,


Riza Nugraha
=====================
Email : [EMAIL PROTECTED]
Website : http://rnugraha.net

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to