Chapter 9. Runtime Deployment

9.1. JDOHelper
9.2. KodoHelper
9.3. J2EE Deployment

Kodo JDO offers many deployment options.

9.1. JDOHelper

Kodo fully supports the the JDOHelper.getPersistenceManagerFactory method, which is the standard way to obtain a persistence manager factory in JDO. This method is described in detail in the JDO Overview. Just remember to include the javax.jdo.PersistenceManagerFactoryClass property to in the properties object you pass to the JDOHelper. The value of the property should be the full name of Kodo JDO's JDBCPersistenceManagerFactory class, so that the JDOHelper knows which factory implementation to instantiate.

Example 9.1. Specifying the PersistenceManagerFactory

javax.jdo.PersistenceManagerFactoryClass: kodo.jdbc.runtime.JDBCPersistenceManagerFactory

The example below shows typical code to obtain a persistence manager factory from the JDOHelper using properties loaded from a file.

Example 9.2. Using the JDOHelper

import java.util.*;
import javax.jdo.*;


Properties props = new Properties ();
InputStream propertyRes = getClass ().getClassLoader ().
    getResourceAsStream ("");
props.load (propertyRes);
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory (props);

Once you have obtained a PersistenceManagerFactory, you can cache it for all persistence manager lookups. Even if you do not cache it yourself, Kodo JDO automatically pools persistence manager factories, so that subsequence calls to the JDOHelper with the same set of configuration properties will return the same factory instance.