beautypg.com

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

Page 228

background image

if (rord != null && rord.equalsIgnoreCase("Delete")) {

String str = empdao.deleteEmployee(empid);

Map model = new HashMap();
model.put("del", str);
return new ModelAndView("deleteresult", "model", model);

}

else {
empdao.insertDetail(empid, firstname, lastname, age, email);

Map model = new HashMap();
model

.put("add",
"Transaction Complete - One Employee Added to Employee Database");
return new ModelAndView("insertresult", "model", model);
}
}

Modifying the applicationContext.xml File

Modify the applicationContext.xml file to include the following:

1.

Transaction Manager: It contains the bean definition for the transaction manager class.

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

NOTE:

Because the EmpInfo application contains only JDBC operations,

org.springframework.jdbc.datasource.DataSourceTransactionManager

is

used as the transaction manager class.

2.

AOP Configurations: It contains reference to the transaction advisor and the class on which
the transaction advise will be applicable.


expression="execution(* com.hp.empinfo.service.EmployeeDao.*(..))"/>

3.

Transaction Advice: It contains references to the transaction manager class and transactional
details of the getEmployeeDetail, insertEmployee and deleteEmployee methods
in the EmployeeDao.java class.






4.

AOP Proxy Factory Bean: It creates an AOP proxy factory bean that contains the business
interface and the implementation class as the target.

class = "org.springframework.aop.framework.ProxyFactoryBean">

228 Integrating Frameworks

This manual is related to the following products: