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

JDO allows implementations to optionally support the persistence of arrays. JPOX provides very limited support for arrays at the moment. It currently supports the persistence of byte arrays.

byte arrays

Lets suppose you have a class something like this

public class StoreAccount
{
    /** Name of account. */
    protected String name=null;

    /** Options for the account. */
    protected byte[] options=null;

    protected StoreAccount()
    {
    }

    public StoreAccount(String name, byte[] opts)
    {
        ...
    }

    public String getName()
    {
        return name;
    }

    public byte[] getOptions()
    {
        return options;
    }
}
                

To allow persistence of the byte array field with JPOX you would define MetaData something like this

<class name="StoreAccount" identity-type="datastore">
    <field name="name">
        <extension vendor-name="jpox" key="length" value="max 100"/>
    </field>
    <field name="options" embedded="true">
        <array embedded-element="true"/>
    </field>
</class>
                

That is, you define the field as an array, and that it is embedded.