JDO identity is managed by the
application. The class provided by the application that implements the JDO object id has
all of the characteristics of an RMI remote object, making it possible to use the JDO object
id class as the EJB primary key class. Specifically:
the ObjectId class must be public;
the ObjectId class must implement Serializable;
the ObjectId class must have a public no-arg constructor, which might be the default constructor;
the field types of all non-static fields in the ObjectId class must be serializable, and for portability should be primitive, String, Date, Byte, Short, Integer, Long, Float, Double, BigDecimal, or BigInteger types; JDO implementations are required to support these types and might support other reference types;
all serializable non-static fields in the ObjectId class must be public;
the names of the non-static fields in the ObjectId class must include the names of the primary key fields in the JDO class, and the types of the corresponding fields must be identical;
the equals() and hashCode() methods of the ObjectId class must use the value(s) of all the fields corresponding to the primary key fields in the JDO class;
if the ObjectId class is an inner class, it must be static;
the ObjectId class must override the toString() method defined in Object, and return a String that can be used as the parameter of a constructor;
the ObjectId class must provide a constructor taking either a String alone or a Class and String that returns an instance that compares equal to an instance that returned that String by the toString() method.