JPOX
JPOX
 JPOX Version 1.0
Configuration | Tutorials | Worked Examples | Developer
Obtaining JPOX
JPOX Preparation
JPOX Runtime
Interfaces

JDO requires that implementations support the persistence of interfaces as first class objects (FCO's). JPOX provides this capability.

FCO

Lets suppose you have an interface and implementation classes something like this





You then have a class that contains an object of this interface type

public class ShapeHolder
{
    protected Shape shape=null;
    ...
}
                

To allow persistence of these interfaces with JPOX you would define MetaData for this container class something like this

<class name="ShapeHolder">
    <field name="shape" persistence-modifier="persistent">
        <extension vendor-name="jpox" 
            key="implementation-classes" 
            value="org.jpox.samples.shape.Circle,
                org.jpox.samples.shape.Rectangle,
                org.jpox.samples.shape.Square"/>
    </field>
</class>
                

That is, for any interface object in a class to be persisted, you define the possible implementation classes that can be stored there. JPOX interprets this information and will map the above example classes to the following in the database





So JPOX adds foreign keys to all of the possible implementation tables for the shape field.