Java Reference
In-Depth Information
return fieldNames;
}
}
Unlike other examples you've seen, the
KodoJDOFetchGroupInterceptor
does
not use a
JdoTemplate
to execute a
JdoCallback
because
MethodInvoca-
tion.proceed()
is declared to throw a
Throwable
whereas a
JdoCallback
can
only throw a
JDOException
. Let's look at the details:
Its constructor takes a
PersistenceManagerFactory
and a
Map
as parameters
and saves them.
The
invoke()
method gets the
PersistenceManager
bound to the thread;
saves the original active fields;
B
C
D
E
calls
configureFetchGroups()
to configure
F
G
them;
calls
proceed()
to invoke the original method;
restores the
Fetch-
H
Configuration
to its original state;
and closes the
PersistenceManager
if
necessary.
I
J
The
configureFetchGroups()
method gets the list of field names.
If the list is non-
null
, it iterates through calling
FetchConfiguration.add-
Field()
.
Listing 5.9 show the Spring bean definitions that configure the
KodoFetch-
GroupInterceptor
and applies it to the
PlaceOrderService
.
Listing 5.9
Configuring the KodoFetchGroupInterceptor
<beans>
…
<bean id="FetchGroupInterceptor"
class="net.chrisrichardson.foodToGo.util.jdo.kdo.fetchGroups.
bbbbbbbbb
➥
KodoFetchGroupInterceptor">
<constructor-arg ref="myPersistenceManagerFactory" />
<constructor-arg>
<map>
<entry key="updateQuantities">
<list>
<value>
net.chrisrichardson.foodToGo.domain.
bbbbbbbbbbbbbbb
b
➥
PendingOrder.restaurant
</value>
<value>
net.chrisrichardson.foodToGo.domain.
bbbbbbbbbbbbbbb
b
➥
PendingOrder.lineItems
Search WWH ::
Custom Search