Chapter 6. JDOHelper
Prev | Part II. Java Data Objects | Next

## Chapter 6. JDOHelper

The above diagram depicts the most commonly-used methods of the `javax.jdo.JDOHelper` class. For a complete API reference, consult the class Javadoc.

Applications use the `JDOHelper` for three types of operations: persistence-capable operations, lifecycle operations, and `PersistenceManagerFactory` construction. We investigate each below.

## 6.1. Persistence-Capable Operations

    public static void makeDirty (Object pc);
    public static Object getObjectId (Object pc);
    public static PersistenceManager getPersistenceManager (Object pc);

We have already seen the first two persistence-capable operations, `makeDirty` and `getObjectId`. Given a persistence-capable object and the name of the field that has been modified, the `makeDirty` method notifies the JDO implementation that the field's value has changed so that it can write the new value to the data store. JDO usually tracks field modifications automatically; the only time you are required to use this method is when you assign a new value to some index of a persistent array.

The `getObjectId` method returns the JDO identity object for the persistence-capable instance given as an argument. If the given instance is not persistent, this method returns `null`.

The final persistence-capable operation, `getPersistenceManager`, is self-explanatory. It simply returns the `PersistenceManager` that is managing the persistence-capable object supplied as an argument. If the argument is a transient object, meaning it is not managed by a `PersistenceManager`, `null` is returned.

Prev | Up | Next
5.2. Metadata Placement | Home | 6.2. Lifecycle Operations