Home » JDO » PersistenceCapable » jdoNewObjectIdInstance(o) - JDO PersistenceCapable's method

jdoNewObjectIdInstance(o) - JDO PersistenceCapable's method

Method
javax.jdo.spi.PersistenceCapable
Object jdoNewObjectIdInstance(
  Object o
)

Create a new instance of the class used for JDO identity, using the key constructor of the object id class. It is intended for single field identity. The identity instance returned has no relationship with the values of the primary key fields of the persistence-capable instance on which the method is called. If the key is the wrong class for the object id class, null is returned.

For classes that use single field identity, if the parameter is of one of the following types, the behavior must be as specified:

  • Number or Character: the parameter must be the single field type or the wrapper class of the primitive field type; the parameter is passed to the single field identity constructor
  • ObjectIdFieldSupplier: the field value is fetched from the ObjectIdFieldSupplier and passed to the single field identity constructor
  • String: the String is passed to the single field identity constructor
Parameters:
o - the object identity constructor parameter
Returns:
the new instance created.
Since:
JDO 2.0

This documentation page is derived (with some adjustments) from the JDO 2.2 API
and is available under the terms of the Apache License, v. 2.0.