beautypg.com

Modifying the applicationcontext.xml file – HP Integrity NonStop J-Series User Manual

Page 240

background image

Modifying the EmpInfo application involves the following tasks:

“Modifying the applicationContext.xml File” (page 240)

“Modifying the EmployeeDao.java File” (page 241)

“Creating the Employee.hbm.xml File” (page 242)

“Removing the EmployeeRowMapper.java File” (page 245)

“Adding Dependency JAR Files” (page 246)

Modifying the applicationContext.xml File

Modify the EmpInfo/WebContent/WEB-INF/applicationContext.xml file, so that it uses
the Hibernate SessionFactory to connect to the employee SQL/MX database table using the
following steps:

1.

Specify the SessionFactory in the applicationContext.xml file as shown:

class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">


Employee.hbm.xml





org.hibernate.dialect.SqlmxDialect

Example of Integrating Hibernate into Spring 9

true





2.

Modify the bean instance of the EmployeeDao class to add the reference of the Hibernate
SessionFactory, as shown:





After modification, the applicationContext.xml file should appear as:


xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

class="org.springframework.jdbc.datasource.DriverManagerDataSource"
>

${jdbc.driver}


${jdbc.url}


${jdbc.user}

240 Integrating Frameworks

This manual is related to the following products: