gpt4 book ai didi

java - Hibernate多行插入postgresql

转载 作者:行者123 更新时间:2023-11-29 13:00:24 25 4
gpt4 key购买 nike

现在我可以使用 hibernate 批量插入 ("hibernate.jdbc.batch_size = 50)但据我所知,hibernate 会批量生成单个 插入。我知道我可以告诉我的数据库驱动程序为每批插入创建多行插入,以使用 rewriteBatchedStatements 提高性能:jdbc:postgresql://localhost:5432/mydb?rewriteBatchedStatements=true

但是在数据库日志中仍然有单个插入。我究竟做错了什么?谢谢。

最佳答案

这实际上与Hibernate无关。插入由 JDBC 驱动程序处理。

rewriteBatchedStatements 是 MySQL 特定参数,因此它不适用于 PostgreSQL 数据库。如果您真的需要使用 PostgreSQL 进行批量插入,请查看 this other answer这解释了如何去做。

关于java - Hibernate多行插入postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32121711/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com