you could try to define an extent in classdescriptor of Address pointing to PersonAddress. BUT the problem is that extents and super-references do not go together well. you may end up with instances of the wrong class. the support for mapping one class to multiple tables needs improvement ;)
jakob
Peter Wieland wrote:
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]