Spring batchupdate method: execute batch update statement
•
Java
batchUpdate(String[] sql)
Example
public static void main(String[] args){
ApplicationContext context = new ClassPathXmlApplicationContext("cfg/XMLConfig.xml"); //加载配置文件
Dao dao = (Dao)context.getBean("dao"); //创建Dao
JdbcTemplate jtm = dao.getJdbcTemplate();
String[] sqls = {
"delete from tb_user where age<27","delete from tb_user where age>35"
};
int[] batchUpdate = jtm.batchUpdate(args);
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
