日期:2014-05-18 浏览次数:20788 次
第一个xml
<context:annotation-config/>
<aop:config proxy-target-class="true"></aop:config>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />
<property name="jdbcUrl" value="jdbc:oracle:thin:@localhost:1521:orcl" />
<property name="user" value="ierp" />
<property name="password" value="ierp" />
<property name="initialPoolSize" value="10" />
<property name="maxPoolSize" value="15" />
<property name="minPoolSize" value="5" />
<property name="maxIdleTime" value="1000" />
</bean>
<!-- 设置JDBC信息 -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
<aop:config proxy-target-class="true"></aop:config>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
第二个xml
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="poBaseService" class="bin._08purchase._0801purchaseorder._080101pobase.POBaseImpl"/>
<bean id="actionpobaselist" class="bin._08purchase._0801purchaseorder._080101pobase.ActionPOBaseList"/>
<bean id="actionpobasemanager" class="bin._08purchase._0801purchaseorder._080101pobase.ActionPOBaseManager"/>
<bean id="actionpobasesingleinfo" class="bin._08purchase._0801purchaseorder._080101pobase.ActionPOBaseSingleInfo"/>
@Transactional(propagation=Propagation.REQUIRED,rollbackFor=java.sql.SQLException.class)
public ExecMsg e_updatePoBase(POBaseBean poBaseBean) {
ExecMsg execMsg = new ExecMsg(); // 返回参数
try {
// 设置执行主键
execMsg.setContent(poBaseBean.getPocode());
// 构建sql语句
StringBuffer sql = new StringBuffer(); // sql代码
sql.append(" update tb_pobase set COCODE = ? ,CPCODE = ? ,POAD = to_date(?,'yyyy-mm-dd') ,POADVANCE = ? ");
sql.append(" ,POAPCODE = ? ,POAPRO = ? ,POBCODE = ? ,POCODE = ? ,PODATE = to_date(?,'yyyy-mm-dd') ,PODESC = ? ");
sql.append(" ,POISTAX = ? ,POREMARK&nbs