opensubscriber
   Find in this group all groups
 
Unknown more information…

t : torque-user@db.apache.org 4 September 2009 • 4:43AM -0400

Primary key is set to the foreign key value
by levko

REPLY TO AUTHOR
 
REPLY TO GROUP





I have very simple DB schema, where the 1st table (Person) has PK 'id' and
the 2nd table (Person_SSN) has FK 'person_id' referring to the 'id' field of
the 'Person' table. The 'Person_SSN' table has its own PK 'ssn':

<database name="test" defaultIdMethod="idbroker">
  <table name="Person" description="Person Data">
    <column name="ID"
      javaName="PersonId"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Person ID"/>
    <column name="FULL_NAME"
      javaName="FullName"
      required="true"
      type="VARCHAR" size="128"
      description="Full Name"/>
    <column name="EMAIL"
      javaName="EMailAddress"
      required="true"
      type="VARCHAR" size="128"
      description="EMail Address"/>
    <unique>
      <unique-column name="EMAIL"/>
    </unique>
  </table>
  <table name="Person_SSN" description="Person SSN">
    <column name="PERSON_ID"
      javaName="PersonId"
      required="true"
      type="INTEGER"
      description="Foreign key Person"/>
    <column name="SSN"
      required="true"
      primaryKey="true"
      type="CHAR" size="9"
      description="SSN"/>
    <foreign-key foreignTable="Person" onDelete="cascade">
      <reference local="PERSON_ID" foreign="ID"/>
    </foreign-key>
  </table>
</database>

When I create 'PersonSsn' object, I set SSN to '123456789', but the DB
record shows that  SSN value is the same as the PERSON_ID value. I use
Torque 3.3 and PostgreSQL 8.4.0.

Could you, please, help me to understand what's the problem here?
I've uploaded the source files. The test driver is in the lk.test.TestOM
class.

Thanks in advance for any idea,
-- Lev http://www.nabble.com/file/p25283761/Test.zip Test.zip
--
View this message in context: http://www.nabble.com/Primary-key-is-set-to-the-foreign-key-value-tp25283761p25283761.html
Sent from the Apache DB - Torque Users mailing list archive at Nabble.com.


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

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.