db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject Re: Inheritance proposal
Date Tue, 09 Aug 2005 14:53:46 GMT
Hi Andy,

> Hi Michael(s),
> 
> Not fully read your proposal, so can't comment on the rest ...
> 
> 
>>- Does JDO require a inheritance element for classes in an inheritance
>>hierarchy? If not, is there a default? The same questions apply to the
>>strategy attribute inside of the inheritance element.
> 
> 
> You don't need to specify it. The default (strategy) is
> * If the class has no persistence capable superclass, use "new-table"
> * If the class has a persistence capable superclass, use "superclass-table"

You are right, I overlooked the default specification in chapter 15.7.

> 
> 
>>- Can I figure out whether inherited fields are mapped to the superclass
>>or subclass table by just looking at the inheritance strategy? I think
>>the answer is no, correct?
> 
> 
> Yes you can. The inheritance always has a strategy (see default above), so you 
> know where the field will be persisted. I *believe* that the 
> <inheritance><join> is only for specifying the names of the primary key 
> columns in app identity cases. Perhaps there's some other use for it that I 
> don't know of ?

Suppose there are two non-abstract persistence-capable classes A and B. 
Class B extends A. Both explicitly define the inheritance strategy 
new-table. Class A maps to table TA and B maps to table TB. Then there 
are still two scenarios possible, depending on where to store the 
inherited fields of B instances:
(1) In table TA. Then we need a <join> element, since a class B instance 
is represented by a row in table TA and a row in table TB.
(2) In table TB. No <join> element is needed since TB includes columns 
for the inherited fields. So TA only has rows for class A instances, not 
for B instances.

Regards Michael
-- 
Michael Bouschen		Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de	http://www.tech.spree.de/
Tel.:++49/30/235 520-33		Buelowstr. 66			
Fax.:++49/30/2175 2012		D-10783 Berlin			

Mime
View raw message