beautypg.com

Modifying applicationcontext.xml file, Modifying, Applicationcontext.xml – HP Integrity NonStop H-Series User Manual

Page 376: File

background image

model.put("empln", emp1.getLastname());
model.put("empage", "" + emp1.getAge());
model.put("empemail", emp1.getEmail());

return new ModelAndView("retrieveresult", "model", model);

}

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

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.



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.



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.






376

Using Spring Transaction Manager

This manual is related to the following products: