Defining the transaction datasource, Defining the platformtransactionmanager – HP Integrity NonStop J-Series User Manual
Page 69

</aop:config>
In this case, the <aop:config/> 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
“Configuring JDBC Driver for SQL/MX Database”
.
Add the following lines in the applicationContext.xml file to create the datasource:
<?xml version="1.0" encoding="UTF-8"?>
<beans
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">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>${jdbc.driver}</value>
</property>
<property name="url">
<value>${jdbc.url}</value>
</property>
<property name="username">
<value>${jdbc.user}</value>
</property>
<property name="password">
<value>${jdbc.password}</value>
</property>
</bean>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
</beans>
NOTE:
Here org.apache.commons.dbcp.BasicDataSource is used as the datasource.
Defining the PlatformTransactionManager
The PlatformTransactionManager is an interface; it is not tied to a lookup strategy such as
JNDI, thereby making it abstract while working with JTA.
The PlatformTransactionManager interface implementations normally require knowledge
of the environment in which they work, such as JDBC, or JTA or Hibernate and so on.
For JDBC, the implementation of PlatformTransactionManager is
org.springframework.jdbc.datasource.DataSourceTransactionManager
.
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
</beans>
Spring Framework Configurations
69