Thanks for your responses, I will definately have a look at the XDoclet
OJB module.
Including the <extent-class> tag in the User class description has made
the situation worse - now all of the inheirited properties are null. I
had got the impression from the mapping tutorial that it was not safe to
use the extent tag and the "super" reference-descriptor at the same
time.
Also, if I specify the reference again in the class descriptor of the
subclass I run into more problems as Armin has just noted- adding
<reference-descriptor name="userLevel"
class-ref="com.mp.hato.ojb.OJBUserLevel" auto-retrieve="true">
<foreignkey field-ref="userLevelId"/>
</reference-descriptor>
to the Person class-descriptor has OJB expecting the userLevelId field
to be in the Person table as well, which crates more confusion
(especially as I have other classes inheriting User)
I guess I'll have to go for the "Mapping Each Class to a Distinct
Table" approach...
>>> [EMAIL PROTECTED] 04/07/04 10:25AM >>>
As far as I can see, there are two problems here:
* OJB is only aware of the inheritance hierarchy if you declare it in
your
class descriptor, e.g. in your case:
<class-descriptor class="User" table="users">
<extent-class class-ref="Person"/>
...
(Note that this is the opposite direction to the Java 'extends').
* Descriptors are not inherited in OJB. If you want a subclass to have
the
same fields/references/collections as its base class in terms of the
database, then you have to specify them again in the class-descriptor
of
the subclass. You should also take care that the definitions of the
primary keys are equal, otherwise you might run into problems (in your
case the primary key of User is autoincrement, but the primary key of
Person is not).
This is btw. independent of whether you map the base- and subclass to
the
same or to different tables.
You might want to check out the XDoclet OJB module which handles this
automatically for you.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
The information in this e-mail is confidential and intended to be solely for the use
of the addressee(s) and may contain copyright and/or legally privileged information.
If you are not the addressee (or responsible for delivery of the message to the
addressee) please e-mail us at [EMAIL PROTECTED] and delete the message from your
computer; copying, distribution, use or disclosure of its contents is strictly
prohibited.
As Internet communications are capable of data corruption no responsibility is
accepted for changes made to this message after it was sent. For this reason it may be
inappropriate to rely on advice contained in any e-mail without obtaining written
confirmation of it.
In addition, no liability or responsibility is accepted for viruses and it is your
responsibility to scan attachments (if any).
Please note that for business purposes, outgoing and incoming emails from and to the
company may be monitored and recorded.
Mouchel Parkman UK Ltd, Registered in England at West Hall, Parvis Road, West Byfleet,
Surrey UK KT14 6EZ Registered No : 1686040
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]