Hibernate EntityManager persist() and database round trip count

时光怂恿深爱的人放手 提交于 2019-12-04 17:23:22

If you need batching in hibernate jpa,try setting

<property name="hibernate.jdbc.batch_size" value="100" />

As per JPA spec:

The managed entity X will be entered into the database at or before transaction commit or as a result of the flush operation.

So, flush is the database round trip.

BTW if you are using hibernate-jpa with spring (transaction), then spring will manage transactions for you. You need not be calling em.flush (ideally)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!