批处理对大量数据的insert或着udpate有着时间上的优越性
看代码
这个主要用的是回调
public void insertPropSluiceLogList(final List<PropSluiceLog> propSluiceLogList) {
getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
executor.startBatch();
for(PropSluiceLog propSluiceLog : propSluiceLogList){
executor.insert("T_PROP_SLUICE_LOG.insertPropSluiceLog", propSluiceLog);
}
executor.executeBatch();
return null;
}
});
}
这个主要是要用事物
public List<HotelInfo> findHotelInfoFogPaginatedList(HotelSearchVO hotelSearchVO,int fromPage,int toPage) {
List<HotelInfo> list = new ArrayList<HotelInfo>();
List<String> props = new ArrayList<String>();
props = hotelSearchVO.getProps();
SqlMapClient sqlMapClient = this.getSqlMapClient();
Map map = new HashMap();
map.put("hotelSearchVO", hotelSearchVO);
map.put("row_from", fromPage);
map.put("row_to", toPage);
map.put("tp_flag", "1");
try{
sqlMapClient.startTransaction();
sqlMapClient.startBatch();
for(int i = 0 ; i < props.size(); i ++){
String propId = props.get(i);
sqlMapClient.insert("Prop.insertTpPropid",propId);
}
sqlMapClient.executeBatch();
list = sqlMapClient.queryForList("Prop.findHotelInfoAll", map);
sqlMapClient.endTransaction();
}catch(Exception e){
logger.info("class name TPDAO--method findHotelInfoFogPaginatedList error!"+e);
}
return list;
}
分享到:
相关推荐
Spring Batch 是一个轻量级的、完善的批处理框架,旨在帮助企业建立健壮、高效的...如果需要使用调用框架,在商业软件和开源软件中已经有很多优秀的企业级调度框架(如 Quartz、Tivoli、Control-M、Cron 等)可以使用。
Spring Batch批处理框架Spring Batch批处理框架Spring Batch批处理框架
Spring Boot整合Spring Batch的一个小例子,在网上发现这方面的资源比较少,特此将其上传供大家学习。
1,什么是批处理 3 2,什么是 Spring Batch 3 二,Spring Batch结构 4 1,Spring Batch体系结构 4 2,Spring Batch主要对象 5 三,Spring Batch流程介绍 5 四,Spring Batch之Step执行过程介绍 6 五,Spring Batch...
java毕业设计 基于SpringBoot和SpringBatch的批处理系统源码+使用文档+全部资料(优秀项目).zipjava毕业设计 基于SpringBoot和SpringBatch的批处理系统源码+使用文档+全部资料(优秀项目).zip 【备注】 1、该项目...
资源名称:Spring Batch 批处理框架内容简介:《Spring Batch 批处理框架》全面、系统地介绍了批处理框架Spring Batch,通过详尽的实战示例向读者展示了Spring Batch框架对大数据批处理的基本开发能力,并对框架的...
Spring DAO入门实例入门实例DOC,经典入门
2024最新!一文看懂Spring Batch批处理(大白话版,干货满满), 学习你将收获: 一.系统了解Spring Batch批处理; 二.项目中能熟练使用Spring Batch批处理
Spring Batch Admin 是一个后端采用spring boot 2, spring security , oauth2, Spring data jpa 作为基础框架,集成了quartz 提供调度能力,集成了Spring batch 提供批处理能力的管理系统。系统旨… 各领域数据集,...
Spring DAO
Spring 数据库访问的支持。包括统一异常体系和Spring的Template+CallBack的解读
ibatis 完美例子 一对多 批处理 事务 和 spring struts2集成 ,一朵多 插入1万条数据,不到2秒,备注不包含类库
基本篇重点讲述了数据批处理的核心概念、典型的作业配置、作业步配置,以及Spring Batch框架中经典的三步走策略:数据读、数据处理和数据写,详尽地介绍了如何对CVS格式文件、JSON格式文件、XML文件、数据库和JMS...
spring dao patternspring dao patternspring dao patternspring dao pattern
Spring Batch是一个轻量级,全面的批处理框架,旨在开发对企业系统日常运营至关重要的强大批处理应用程序。 Spring Batch构建了人们期望的Spring Framework特性(生产力,基于POJO的开发方法和一般易用性),同时使...
Spring的DAOSpring的DAOSpring的DAOSpring的DAOSpring的DAOSpring的DAOSpring的DAOSpring的DAOSpring的DAO
使用Spring实现DAO模式
spring-dao.jar spring-dao.jar