Java Reference
In-Depth Information
Java Class
a user-
rating, an
between 0
to 100
A user-provided
integer rating for a
piece of content.
Normalized to a 0-
100 scale.
CRUDing Entities
With most datastores, obtaining a connection is an expensive process. The App
Engine's datastore is no different. Applications utilizing JDO interact with the
datastore by using an instance of the PersistenceManager class. By instantiating an
instance of the PersistenceManagerFactory class, the factory creates an instance of
the PersistenceManager using the JDO configuration. Due to the high overhead of
creating the instance, you should wrap this class in a singleton so that it can be
reused and prevented from creating additional instances.
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;
public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
private PMF() {}
public static PersistenceManagerFactory get() {
return pmfInstance;
Creating Entities
Once you have a connection to the datastore, it's relatively simple to persist entities.
Just create a new instance, and then pass it to the makePersistent synchronous
PersistenceManager pm = PMF.get().getPersistenceManager();
Order o = new Order("Jeff Douglas", "111-222-3333");
Search WWH ::

Custom Search