Java Reference
In-Depth Information
bbb
<props>
b
b
b
<prop key="javax.jdo.option.NontransactionalRead">
b
b
➥
true</prop>
bb
b
<prop key="javax.jdo.option.RetainValues">
b
➥
true</prop>
bbbbb
…
bbb
</props>
bb
</property>
…
</bean>
The
JdoTransactionManager
is configured to use the
PersistenceManagerFactory
configured by the
myPersistenceManagerFactory
bean. The
myPersistenceMan-
agerFactory
bean configures the
PersistenceManagerFactory
to allow nontrans-
actional reads. Setting the
NontransactionalRead
property to
true
allows the
JSP
pages to navigate the object graph and perform queries outside of a transaction.
Setting the
RetainValues
property to
true
tells the
JDO
implementation to keep
the objects that were accessed during the transaction in the cache after the trans-
action commits. This improves performance because it ensures that they will not
be reloaded when they are accessed by the
JSP
pages outside of the transaction.
Not shown are the
JDO
implementations of the repositories, which are configured
in the same way as in chapter 7.
Now that we have configured the Spring beans, let's configure the web applica-
tion.
8.5.2
Configuring the web application
To be able to deploy the application in a web container, we must first package the
application's components, including the servlets and business logic classes, as a
web application. One part of creating the web application is defining some entries
in its web.xml file. The web.xml configures the servlets, which handle the
HTTP
requests, the Spring
WebApplicationContext
, and the
OpenPersistenceManager-
InViewFilter
, which is the servlet filter that opens and closes the
PersistenceMan-
ager
. Listing 8.3 shows an example configuration.
Listing 8.3
web.xml for the Open PersistenceManager in View example
<web-app>
B
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/placeOrderService-exposedDomain-beans.xml
…
</param-value>
</context-param>
Search WWH ::
Custom Search