Hi,

I tried torque and run into problem with references.

Look at this shema:

<table name="CLASS_1">
  <column name="PK" primaryKey="true" type="INTEGER"/>
  <column name="NAME" type="VARCHAR" required="true"/>
</table>


<table name="CLASS_2">
  <column name="PK" primaryKey="true" type="INTEGER"/>
  <column name="NAME" required="true" type="VARCHAR"/>
  <column name="FK" required="true" type="INTEGER"/>

  <foreign-key foreignTable="CLASS_1" name="CLASS_1">
      <reference foreign="PK" local="FK"/>
  </foreign-key>
</table>



The primary keys can be 0. When I store two objects like this:

Class1 c1 = new Class1();
c1.setPk(0);
c1.save();

Class2 c2 = new Class2();
c2.setPk(0);
c2.setClass1(c1);
c2.save();


And then do the this query later:

Class2 c2 = Class2Peer.retrieveByPK(0);
Class1 c1 = c2.getClass2(); <--- null

, then c1 is null.

When Class1 primary key is non 0 then it works fine.


Do I really need to use another primary key with, for example, auto increment to avoid this problem?
Class1.retrieveByPK(0) works fine, why not c2.getClass2()?


Thanks,
Patrick

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

Reply via email to