According to the App Engine docs, the PersistenceManagerFactory
should only be created once in the application.
It provides this sample:
package guestbook;
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;
public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory("transactions-optional");
private PMF() {}
public static PersistenceManagerFactory get() {
return pmfInstance;
}
}
Why does PMF.java
have to be a "public final class
" in addition to making the pmfInstance
a "private static final
" object?