The getStoreStatement method in SQLEngine.java was returning the following
prepared statement for the Worker class:
UPDATE WORKER SET  WHERE WORKERKEY=?

The database driver was complaining because SET had no arguments since the
Worker class only has 1-to-many relationships.  I went on to put a dummy
field in the Worker class and in the Table then things seemed to work.
That's with all the classes in the hierarchy being concrete.  I'll try to
abstract them and see what the end result will be.


Thank you.




-----Original Message-----
From: Toni Charlot [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 12, 2001 9:32 AM
To: '[EMAIL PROTECTED]'
Subject: inheritance, can I do this..


I've been having some troubles maybe a lot more than I should.  Can I do
this using Castor

BaseOBj <-- ObjAbstract <-- ObjExtAbstract <-- ObjExt2Abstract <--
ObjExt2Concrete

I've also tried the above where I made the Abstract classes concrete and I'm
still having difficulties.

my mapping file looks something like the following:

<!-- Table: DBOBJECT, Owner: TONI  -->
      <class name="isman.base.DBObject" identity="key"
key-generator="SEQUENCE">
        <description>Master Object</description>
        <map-to table="DBOBJECT" xml="DBObject"/>
        <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <field name="key" type="integer">
          <sql name="DBOKEY" type="integer"/>
          <bind-xml node="attribute"/>
        </field>
        <field name="parentKey" type="integer">
          <sql name="PARENTKEY" type="integer"/>
          <bind-xml node="attribute"/>
        </field>
        <field name="datestamp" type="date"><!-- this should to be readonly
in the application -->
          <sql name="DATESTAMP" type="timestamp"/>
          <bind-xml node="element"/>
        </field>
        <field name="userstamp" type="string">
          <sql name="USERSTAMP" type="varchar"/>
          <bind-xml node="element"/>
        </field>
        <field name="inUse" type="boolean">
          <sql name="INUSE" type="char"/>
          <bind-xml node="element"/>
        </field>
      </class>


<!-- Table: PERSON, Owner: TONI -->
      <class name="isman.base.person.Person"
             extends="isman.base.DBObject"
             identity="key">
        <description>Person</description>
        <map-to table="PERSON" xml="Person"/>
        <!-- +++++++++++++++++++++++++++++++++ -->
        <field name="key" type="integer" >
          <sql name="PERSONKEY" type="integer"/>
          <bind-xml node="attribute"/>
        </field>
        <field name="lastName" type="string">
          <sql name="LASTNAME" type="varchar"/>
          <bind-xml node="element"/>
        </field>
        <field name="middleName" type="string" >
          <sql name="MIDDLENAME" type="varchar"/>
          <bind-xml node="element"/>
        </field>
        <field name="firstName" type="string" >
          <sql name="FIRSTNAME" type="varchar"/>
          <bind-xml node="element"/>
        </field>
     </class>

<!-- Table: COLLEAGUE, Owner: TONI -->
      <class name="isman.base.person.Colleague"
             extends="isman.base.person.Person"
             identity="key">
        <description>Person</description>
        <map-to table="COLLEAGUE" xml="Colleague"/>
        <!-- +++++++++++++++++++++++++++++++++ -->
        <field name="key" type="integer" >
          <sql name="COLLEAGUEKEY" type="integer"/>
          <bind-xml node="attribute"/>
        </field>
        <field name="startDate" type="date">
          <sql name="STARTDATE" type="date"/>
          <bind-xml node="element"/>
        </field>
        <field name="endDate" type="date">
          <sql name="ENDDATE" type="date"/>
          <bind-xml node="element"/>
        </field>
        <!-- identification -->
        <field name="identificationObj" type="isman.base.Identification">
          <sql name="IDKEY"/>
          <bind-xml name="identification" node="element"/>
        </field>
      </class>

<!-- Table: WORKER, Owner: TONI -->
      <class name="isman.base.person.Worker"
             extends="isman.base.person.Colleague" identity="key">
        <description>Person</description>
        <map-to table="WORKER" xml="Worker"/>
        <!-- +++++++++++++++++++++++++++++++++ -->
        <field name="key" type="integer" >
          <sql name="WORKERKEY" type="integer"/>
          <bind-xml node="attribute"/>
        </field>
        <!-- education File -->
        <field name="educationFile" type="isman.base.Education"
               collection="collection">
          <sql many-key="PARENTKEY"/>
          <bind-xml name="education" node="element"/>
        </field>
        <!-- employment history File -->
        <field name="historyFile" type="isman.base.History"
               collection="collection">
          <sql many-key="PARENTKEY" />
          <bind-xml name="history" node="element"/>
        </field>
      </class>

<!-- Table: EMPLOYEE, Owner: TONI -->
      <class name="isman.base.person.Employee"
             extends="isman.base.person.Worker" identity="key">
        <description>Person</description>
        <map-to table="EMPLOYEE" xml="Employee"/>
        <!-- +++++++++++++++++++++++++++++++++ -->
        <field name="key" type="integer" >
          <sql name="EMPLOYEEKEY" type="integer"/>
          <bind-xml node="attribute"/>
        </field>
        <!-- personal Info -->
        <field name="personalInfoObj" type="isman.base.PersonalInfo">
          <sql name="PERSONALINFOKEY"/>
          <bind-xml name="personal" node="element"/>
        </field>
        <!-- Wages -->
        <field name="wagesObj" type="isman.base.Wages">
          <sql name="WAGESKEY" />
          <bind-xml name="wages" node="element"/>
        </field>
      </class>

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

Reply via email to