java吧 关注:1,235,047贴子:12,701,742
  • 5回复贴,共1

求指点spring回滚问题

取消只看楼主收藏回复

贴代码:
<context:component-scan base-package="com.demo.controller,com.demo.dao,com.demo.domain,com.demo.service" />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/software"/>
<property name="username" value="root"/>
<property name="password" value="1234"/>
<property name="maxActive" value="30"/>
<property name="maxIdle" value="10"/>
<property name="maxWait" value="500000"/>
<property name="poolPreparedStatements" value="true"/>
<property name="defaultAutoCommit" value="true"/>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="/WEB-INF/config/sql-map-config.xml"/>
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient" ref="sqlMapClient"/>
</bean>
java代码:
@Service("customerService")
@Transactional
public class CustomerServiceImpl implements CustomerService{
@Autowired
private CustomerDao customerDao;
@Override
public Integer addCustomer(Customer customer){
int i =0;
try{
Integer maxId = customerDao.findMaxID();
if(null == maxId){
maxId=0;
}
customer.setCustomernum("KHBH-"+(maxId+1));
i=customerDao.addCustomer(customer);
}catch(Exception e){
throw new RuntimeException();
}
return i;
}
求指点。。。。。。。。。。。。。。。
}


IP属地:北京1楼2015-02-03 17:02回复
    自己顶。。


    IP属地:北京2楼2015-02-03 17:03
    回复
      继续顶


      IP属地:北京3楼2015-02-03 17:06
      回复
        这个点没人?


        IP属地:北京4楼2015-02-03 17:12
        回复
          来人啊


          IP属地:北京6楼2015-02-04 11:15
          回复
            来人 来人


            IP属地:北京7楼2015-02-04 11:25
            回复