Configuring database transaction management, Declarative transaction management, Defining the transactional object – HP Integrity NonStop H-Series User Manual
Page 80

NOTE:
For information on the complete configuration snippet of the
applicationContext.xml
file and the
jdbc.properties
file, see
Configuring Database Transaction Management
Spring framework provides the following ways for configuring transaction management:
•
Declarative Transaction Management: In this case, the transaction action is defined in an
XML configuration file for each method (or class).
•
Programmatic Transaction Management: In this case, the transaction action is hardcoded
in the code. This is similar to the JDBC transaction.
Declarative Transaction Management
This section describes the following steps to configure transactions in Spring applications using
declarative approach:
•
Defining the Transactional Object
•
Defining the Transactional Advice
•
Defining the Transactional Execution Point
•
Defining the Transaction Datasource
•
•
Defining the Transaction Rollback (Optional)
NOTE:
In a typical Spring application, this configuration must be done in the
applicationContext.xml
file.
Defining the Transactional Object
To define a service object to be used as a transactional object, add the following line in the
applicationContext.xml
file:
For example:
Consider the following service interface, and its implementation:
// the service interface that we want to make transactional
package a.b.service;
public interface MyService {
MyObject getMyObject(String myObjectName);
MyObject getMyObject(String myObjectName, String myObjectDesc);
void insertMyObject(MyObject myobject);
void updateMyObject(MyObject myobject);
}
// an implementation of the above interface
package a.b.service;
public class DefaultMyService implements MyService {
public MyObject getMyObject(String myObjectName) {
throw new UnsupportedOperationException();
80
Configuring Spring Applications on NonStop Systems