Chapter 7. Establishing a JDO Runtime Environment

This chapter describes how to establish a JDO runtime environment. This includes specifying the particular JDO implementation to be used, connecting to the datastore, and setting various properties that control the management of transactions and the cache of persistent instances.

Your primary interface when using JDO is the PersistenceManager interface. You configure a PersistenceManager instance by using a PersistenceManagerFactory instance, which you can create by calling a method defined in JDOHelper . Or, in a Java 2 Platform, Enterprise Edition (J2EE) environment, you would likely use Java Naming and Directory Interface (JNDI) to store and look up one or more PersistenceManagerFactory instances.

You can initialize and set various properties within the PersistenceManagerFactory , including the information needed to connect to the datastore. Once you have established the desired configuration, you call a PersistenceManagerFactory method to create a PersistenceManager instance. You can create multiple PersistenceManager s from a single PersistenceManagerFactory , and you can alter some of the properties in a PersistenceManager once it has been created.

A PersistenceManager instance has a one-to-one relationship with an associated Transaction instance. The PersistenceManager interface provides a method to access this instance. The property settings in the PersistenceManager and Transaction instances control the runtime behavior of the JDO runtime environment.

Figure 7-1 illustrates the relationships among these classes and the methods you can use to access and create the associated instances. This chapter describes the capabilities these interfaces provide, so you can configure your application's runtime environment for accessing the datastore.

Figure 7-1. Interfaces used to configure and control the JDO runtime environment
figs/jdo_0701.gif


Java Data Objects
ADO.NET Programming with CDR (Wordware programming library)
ISBN: 596002769
EAN: 2147483647
Year: 2005
Pages: 159

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net