i tried to change my code to using extends, it works perfect for me, and
from an object oriented design view, this is perfect!

what i did (if i apply the things i did to georgs problem):

- create an abstract class Address that has all attributes in it
- derive both classes HomeAddress and WorkAddress from Address
- setup the constructor of both classes as described in
 
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Extents+and+Pol
ymorphism
- setup the repository.xml as described in the chapter
 
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+All+Cla
sses+on+the+Same+Table

this works perfect for me and is much cleaner (but of course works only if
you can change your db layout).
if you can't change the layout, one possible solution is described in
 
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+All+Cla
sses+on+the+Same+Table
when showing how to implement your own ClassDescriptor. cool stuff!

kr,
guenther


-----Original Message-----
From: Georg Müller [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 03, 2005 11:33 PM
To: OJB Users List
Subject: Re: Mapping question

Thomas Dudziak wrote:
> As far as I understand he wants to use a reference that refers to a 
> class with a compound primarykey, where one of the foreignkey values 
> is fixed:
> 
> <reference-descriptor name="homeAddress"
>                       class-ref="Address"
>                       auto-update="true"
>                       auto-delete="true">
>   <foreignkey field-ref="login" />
>   <foreignkey expression="heimat" />
>   <!-- the second part of the fk relating to pk part 'type', is fixed 
> to "heimat" --> </reference-descriptor>
> 

Yes, that is what I am searching for.

---------------------------------------------------------------------
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