Java Reference
In-Depth Information
list of field names.
PlaceOrderFieldProxyCreator
applies the
KodoFetch-
GroupInterceptor
to the
PlaceOrderService
.
Each time the
PlaceOrderService
is called, the
KodoFetchGroupIntercep-
tor
will add the specified fields to the
FetchConfiguration
, which will cause
them to be eagerly loaded. If the
UI
design changes and requires different fields
to be loaded, you will just need to edit the Spring bean definition and not modify
any code.
You will be able to configure
JDO 2.0
fetch groups using a similar
AOP
-based
approach. Instead of configuring individual fields, the interceptor will use the
JDO 2.0
API
s to configure the active fetch groups. Eager loading is only one way to
improve performance. Another option is to use process-level caching.
5.4.2
Using a PersistenceManagerFactory-level cache
By default, a
JDO
implementation only caches objects in
PersistenceManager
. It
looks in the
PersistenceManager
cache before loading an object from the data-
base. In addition to ensuring that there is at most one in-memory representation
of a persistent object, the cache improves performance by reducing database
accesses. However, the
PersistenceManager
cache is flushed when a transaction
ends, which means that the next time the application accesses an object the
JDO
implementation has to load it from the database. In a
JDO
application, you can
often improve performance significantly by caching frequently accessed but rarely
modified objects in the
PersistenceManagerFactory
-level cache, which is
JDO'
s
way of providing process-level caching.
Overview of the PersistenceManagerFactory-level cache
The JDO implementation looks in the
PersistenceManagerFactory
-level cache
after checking the
PersistenceManager
cache but before accessing the database.
This cache is not flushed when a transaction commits and consequently contains
objects accessed by multiple transactions. Enabling the
PersistenceManager-
Factory
-level cache can often increase performance significantly by reducing the
number of database accesses.
The
JDO
specification does not define the detailed behavior of the
Persis-
tenceManagerFactory
-level cache or how to configure it. You must typically con-
figure the cache by using a combination of vendor-specific
Persistence-
ManagerFactory
properties and
XML
metadata. For example, the Kodo
JDO
PersistenceManagerFactory
cache is enabled using the following
Persis-
tenceManagerFactory
properties:
Search WWH ::
Custom Search