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

Page 351

Advertising
background image

Modifying the EmpInfo application involves the following tasks:

1.

“Modifying EmpInfo based on the Type of Transaction” (page 351)

“For Declarative Transaction” (page 351)

“Creating the IEmployeeDao.java File” (page 351)

“Modifying the EmployeeController.java File” (page 353)

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

“For Programmatic Transaction” (page 356)

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

“Modifying the EmployeeController.java File” (page 357)

2.

“Adding Dependency JAR Files” (page 359)

“For Declarative Transaction” (page 359)

“For Programmatic Transaction” (page 361)

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.

Example of Using Spring Transaction Manager

351

Advertising
This manual is related to the following products: