beautypg.com

Defining the transactional advice – HP Integrity NonStop H-Series User Manual

Page 81

background image

}

public MyObject getMyObject(String myObjectName, String myObjectDesc) {
throw new UnsupportedOperationException();
}
public void insertMyObject(MyObject myobject) {
throw new UnsupportedOperationException();
}
public void updateMyObject(MyObject myobject) {
throw new UnsupportedOperationException();
}

To make the

DefaultMyService

service object as transactional, the configuration in the

applicationContext.xml

file is:


Defining the Transactional Advice

The next step is to add the transactional advice to the transactional object. The transaction
semantics that must be applied are encapsulated in the

definition.

If you plan to define the transaction advice with the business rule as follows:

All methods starting with 'get' are to execute in the read-only

transaction mode and rest of the methods are to execute with the default

transaction mode”

,

the

definition is configured as:










The

transaction-manager

attribute of the

tag is set to the name of the

PlatformTransactionManager

bean that will drive the transactions.

For example:

Assume that the first two methods of the

MyService

interface

(getMyObject(String)

and

getMyObject(String, String))

must execute in the context of a transaction with read-only

semantics, and that the other methods

(insertMyObject(MyObject)

and

updateMyObject(MyObject))

must execute in the context of a transaction with read-write

Semantics. The configuration is:










Spring Framework Configurations

81

This manual is related to the following products: