Hibernate中的批量处理executeUpdate()
来源:互联网 发布:免费教学软件下载 编辑:程序博客网 时间:2024/06/05 23:43
// 批量处理:JDBC
@org.junit.Test public void jdbcBatch(){ session=HibernateUtil.getSession(); tx=session.beginTransaction(); Work work=new Work(){//匿名内部类、Work实现类 @Override public void execute(Connection conn) throws SQLException { sql="update Emp set sal=sal+2"; PreparedStatement pst=conn.prepareStatement(sql); pst.executeUpdate(); } }; session.doWork(work); tx.commit(); HibernateUtil.closeSession(); }
**// 批量处理:HQL**
public void hqlBatch() { session = HibernateUtil.getSession(); Transaction tx = session.beginTransaction(); hql = "update Emp set comm=50 where comm=0"; Query query = session.createQuery(hql); int num = query.executeUpdate(); System.out.println(num); tx.commit(); HibernateUtil.closeSession(); }
0 0
- Hibernate中的批量处理executeUpdate()
- Hibernate批量处理
- Hibernate 的批量处理
- hibernate 批量处理
- Hibernate的批量处理
- Hibernate批量处理
- Hibernate批量处理
- Hibernate 批量处理
- Hibernate批量处理海量
- hibernate批量处理
- hibernate批量处理数据
- Hibernate 批量处理
- Hibernate 批量处理数据
- hibernate 批量处理
- Hibernate应用 批量处理
- hibernate批量处理数据
- Hibernate的批量处理
- Hibernate 批量处理
- CentOS 7.2 64位安装LNMP php7+Mysql 5.7
- 树回归CART(Classification And Regression Tree)(1)
- Ubuntu server命令行配置shadowsocks全局代理
- 【C++】学习笔记二十二——逻辑表达式
- VBA教程网站
- Hibernate中的批量处理executeUpdate()
- MySql基础的增删改 ddl语句
- guava集合类中List的相关使用方法
- leancloud云引擎集成支付宝(第三方平台都是这么干)
- java JTable表头属性设置
- TCP与UDP
- 742 A - Arpa’s hard exam and Mehrdad’s naive cheat codeforces
- 线程与进程
- vim自动显示行号