beautypg.com

Defining the transactional execution point, Defining the transaction datasource – HP Integrity NonStop H-Series User Manual

Page 82

background image

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:




In this case, the

definition ensures that the transactional advice defined by

the

txAdvice

bean actually executes at the appropriate points in the program. Define a pointcut

that matches the execution of any operation defined in the

MyService

interface

(

myServiceOperation

). Associate the pointcut with the

txAdvice

using an advisor. The

result indicates that at the execution of a

myServiceOperation

, the advice defined by

txAdvice

will be run.

Defining the Transaction Datasource

This section describes the steps to define the datasource that will be used by the transaction. For
more information on datasource configuration, see the

Configuring JDBC Driver for SQL/MX

Database

.

Add the following lines in the

applicationContext.xml

file to create the datasource:


xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">



${jdbc.driver}


${jdbc.url}


${jdbc.user}


${jdbc.password}

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">


classpath:jdbc.properties



82

Configuring Spring Applications on NonStop Systems

This manual is related to the following products: