Java Reference
In-Depth Information
D
The OpenPersistenceManagerInViewFilter is configured to be invoked for all
requests.
The ContextLoaderServlet is a Spring servlet that reads the Spring configure files
specified by the contextConfigLocation parameter and initializes the WebApplica-
tionContext .
The UpdateDeliveryInfoServlet is one of the application's servlets.
This file, along with the Spring bean configuration files, the application classes,
and the required libraries, would be packaged as a web application and deployed
in a web container.
E
F
8.6 Using Hibernate with an exposed domain model
The Hibernate-specific Spring beans and configuration settings are similar to the
JDO beans and settings you just saw. Let's look at them.
8.6.1
Defining the Spring beans
The Hibernate version of the Spring configuration files defines the myTransac-
tionManager Spring bean, which is used by the TransactionInterceptor :
<bean id="myTransactionManager"
class="org.springframework.orm.hibernate.
bbbbbb bbb
HibernateTransactionManager">
<property name="sessionFactory" ref="mySessionFactory"/>
</bean>
The Hibernate repositories and SessionFactory are configured in the same way
we showed you in chapter 7. Since Hibernate automatically supports nontransac-
tional reads, we do not need to configure the SessionFactory in any special way.
8.6.2
Configuring the web application
As with the JDO version, we must configure the web application with some entries
in the web.xml. These entries configure Spring, the OpenSessionInViewFilter ,
and the servlets. Listing 8.4 shows an example configuration.
Listing 8.4
web.xml for the Open Session in View example
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search