Defining the transactional advice, Defining the transactional execution point – HP Integrity NonStop J-Series User Manual
Page 68

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
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
The transaction-manager attribute 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:
Defining the Transactional Execution Point
To ensure that the transactional advice defined in the above step is executed at the appropriate
point in the program, you must define the transactional execution point. This is done using the
definition in the applicationContext.xml file.
Define a pointcut that matches the execution of any operation defined in the Transactional Service
interface. Associate the pointcut with the advisor. The result indicates that at the execution of a
Transactional Service operation, the advice you have defined will be run.
For example:
To run the transactional advice for any execution of an operation defined in the MyService
interface, define the transactional execution point as:
68
Configuring Spring Applications on NonStop Systems