本文介绍了Hibernate批量插入,批量更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有dao,它基本上用hibernate将一条记录插入到一​​个表中,这个dao用 @Transactional 标注 propogation-NESTED ,并且我有一些其他的东西,然后调用我的dao。我的服务也用 @Transactional 加注 propagation-REQUIRED

I have dao which basically inserts a record into a table using hibernate, this dao is marked by @Transactional annotation with propogation-NESTED, and I have service which makes some other stuff and then invokes my dao. My service is also annotated with @Transactional with propagation-REQUIRED.

我在循环中调用服务。我的刀片插入是否可以批量或一个一个地工作?我如何确保他们能够批量工作? hibernateTransaction管理器是否管理批量插入?

I call service in a loop. Does my inserts on my dao works in batch or one by one? How can I be sure that they work in batch? Does hibernateTransaction manager manage batch inserts?

我使用的是Oracle DB。

I am using Oracle DB.

推荐答案

财产和我的表现增加;

I have set following property and my performance increased;

hibernate.jdbc.batch_size=50

这篇关于Hibernate批量插入,批量更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-24 23:53