Modifying empinfo based on the type of transaction, For declarative transaction, Creating the iemployeedao.java file – HP Integrity NonStop J-Series User Manual
Page 225

Modifying the EmpInfo application involves the following tasks:
1.
“Modifying EmpInfo based on the Type of Transaction” (page 225)
•
“For Declarative Transaction” (page 225)
“Creating the IEmployeeDao.java File” (page 225)
◦
◦
“Modifying the EmployeeController.java File” (page 227)
◦
“Modifying the applicationContext.xml File” (page 228)
•
“For Programmatic Transaction” (page 230)
◦
“Modifying the applicationContext.xml File” (page 230)
◦
“Modifying the EmployeeController.java File” (page 231)
2.
“Adding Dependency JAR Files” (page 233)
•
“For Declarative Transaction” (page 233)
•
“For Programmatic Transaction” (page 235)
Modifying EmpInfo based on the Type of Transaction
In Declarative Transaction Management, all the transactions are set and managed by the proxy
factories configured in the Spring configuration file. Therefore, you must modify the
applicationContext.xml
file.
In Programmatic Transaction Management, transaction management is done directly in the code.
Therefore, you must modify the EmployeeController.java file.
The following sections describe the modifications required in the applicationContext.xml
file and the EmployeeController.java file.
For Declarative Transaction
The following activities are involved in the declarative transactions.
Creating the IEmployeeDao.java File
Create a Java interface named IEmployeeDao.java to implement the EmployeeDao.java
class.
The IEmployeeDao.java is placed with its implementation class in the
com.hp.empinfo.service
package.
To create the IEmployeeDao.java file, complete the following steps:
1.
On the Project Explorer frame, right-click EmpInfo and select New > Interface.
The New Java Interface dialog box appears.
2.
In the Source folder field, type EmpInfo/src and in the Package field, type
com.hp.empinfo.service
.
3.
In the Name field, type IEmployeeDao and click Finish.
Using Spring Transaction Manager 225