db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Lethbridge <d...@bund.com.au>
Subject column sharing
Date Fri, 26 Oct 2007 02:31:45 GMT

I have a question about JDO2.0.  When using an inheritance strategy  
of "superclass-table", is it valid for two separate subclasses which  
both have an identically-typed field to actually share a database  
column, rather than specifying a separate column for each of the  
fields?  As far as I can tell, the JDO spec is not clear on this.  Is  
it completely JDO-vendor implementation dependent (i.e. non-portable)?

Below is an illustrative example.  B extends A and also C extends A.   
The fields B.f1 and C.f2 are both declared as references to a  
persistence type "F" but defined to share the column named F_JDOID.   
Any potential problems with this?



<class name="A" table="A">
     <!-- abstract superclass -->
     <datastore-identity column="JDOID" />
         <discriminator strategy="value-map" column="CLASSIND" />
     <version strategy="version-number" column="JDOVERSION" />

<class name="B">
     <!-- extends A -->
     <inheritance strategy="superclass-table" />
         <discriminator value="B" />
     <field name="f1" column="F_JDOID">
         <foreign-key deferred="true" />

<class name="C">
     <!-- extends A -->
     <inheritance strategy="superclass-table">
         <discriminator value="C" />
     <field name="f2" column="F_JDOID">
         <foreign-key deferred="true" />

<class name="F" table="F">
    <datastore-identity column="JDOID" />
    <!-- etc... -->

View raw message