首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

spring入门范例-DAO,声明事务

2012-10-25 
spring入门实例-DAO,声明事务spring入门实例-DAO,事务实例使用代理模式,使用DAO,并且添加事务功能配置文件

spring入门实例-DAO,声明事务

spring入门实例-DAO,事务

实例使用代理模式,使用DAO,并且添加事务功能

配置文件:

/** * use declarative transaction * @author logichina *  */public class DataSourceDAO{private DataSource dataSource;public void setDataSource(DataSource dataSource){this.dataSource = dataSource;this.jdbcTemplate = new JdbcTemplate(dataSource);}private JdbcTemplate jdbcTemplate;public void insertCustomer(){jdbcTemplate.update("insert into t_lpromis_yxgl_khxx(id,khqc) values('000023','testname4')");jdbcTemplate.update("insert into t_lpromis_yxgl_khxx(id,khqc) values('000024','testname5')");jdbcTemplate.update("insert into t_lpromis_yxgl_khxx(id,khqc) values('000023','testname6')");}public static void main(String[] args){ApplicationContext context = new ClassPathXmlApplicationContext("com/myspring/bussiness/declare/datasourceDAO.xml");DataSourceDAO bean = (DataSourceDAO) context.getBean("userDAOProxy");bean.insertCustomer();}}
?

?

?

?

热点排行