Drew,

I'd only be speculating if I formed a response to this question, as I've never attempted what you're trying.

Have you actually given a go at this? What implementation are you using?

- Chris Beams   


On Oct 25, 2007, at 7:31 PM, Drew Lethbridge wrote:

Greetings,

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?

Thanks.

Drew.

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

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

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

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


Reply via email to