Hello,

Anyone have thoughts on this? Feature, bug or user error?

Thanks,
Dave

-----Original Message-----
From: Dave Ballard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 2:55 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Question regarding 'extends' and primary keys


Hello,

In the JDO examples, we have class Computer extending Product. For both
classes, the identity column is 'id'. So when castor generates the SQL to
load a Computer, the JOIN produced "computer.id = product.id". What could be
done if computer's PK was 'computer_id' rather than 'id'. The SQL JOIN
required would be "computer.computer_id = product.id". Is this supported in
mapping file? For instance:

  <!--  Mapping for Computer, extending Product  -->
  <class name="myapp.Computer" extends="myapp.Product"
identity="computer_id">
    <description>Computer definition, extends generic product</description>
    <map-to table="computer" xml="computer" />
    <field name="computer_id" type="integer">
      <sql name="computer_id" type="integer" />
      <xml name="computer_id" node="attribute"/>
    </field>
    <field name="cpu" type="string">
      <sql name="cpu" type="char"/>
      <xml node="element" />
    </field>
  </class>

Castor still generates "computer.id = product.id". So castor appears to
assume all subclasses have the same identity column name as the parent
class. Is this the case?

Thanks,
Dave

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to