Hi Peter,

You will need to add PersonAddress as an Extent of Address if you want
PersonAddress to be in the "seach domain" of a query for class Address.

Wally

-----Original Message-----
From: Peter Wieland [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 04, 2003 4:22 AM
To: [EMAIL PROTECTED]
Subject: Problem mapping inheritance hierarchy using joined tables for
subclasses


Hi,

I try to map two classes Address and PersonAddress (a subclass of
Address) using the joined table per sublcass strategy. This is my
mapping:

  <class-descriptor class="de.armax.sandbox.entity.Address"
    table="Address">
    <field-descriptor autoincrement="true" primarykey="true"
      column="adrOID" jdbc-type="VARCHAR" name="oID"/>
    <field-descriptor column="adrAttribute" jdbc-type="VARCHAR"
name="attribute"/>
    ...
  </class-descriptor>

  <class-descriptor class="de.armax.sandbox.entity.PersonAddress"
    table="PersonAddress">
    <field-descriptor autoincrement="true" primarykey="true"
      column="padOID" jdbc-type="VARCHAR" name="oID"/>
    <field-descriptor column="padAdditionalAttribute"
jdbc-type="VARCHAR"
      name="additionalAttribute"/>
    ...
    <reference-descriptor
      auto-delete="true"
      auto-update="true"
      name="super"
      class-ref="de.armax.sandbox.entity.Address">
      <foreignkey field-ref="oID"/>
    </reference-descriptor>
  </class-descriptor>

Storing new Addresses or Personaddresses works fine. But when I reload
Adresses using

  broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new
Criteria()));

OJB seems not to care about what type these addresses have. All returned
entities will be of type Address, even if they were stored as
PersonAddress. Is this a bug or am I missing something here?

Thanks for any help,

Peter

P.S.: I'm very sorry if this mail appears two times on the list. I send
it from a bad account before and I'm not sure weather the ojb user list
accepts this.

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


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

Reply via email to