gpt4 book ai didi

java - AUTO 和 COMMIT FlushMode 之间有什么区别?

转载 作者:太空宇宙 更新时间:2023-11-04 14:42:47 25 4
gpt4 key购买 nike

  • entityManager.setFlushMode(FlushModeType.AUTO)
  • entityManager.setFlushMode(FlushModeType.COMMIT)

以上两者有什么区别,使用COMMIT有什么好处?冲洗模式?

最佳答案

JPA AUTO causes a flush to the database before a query is executed. Simple operations like find don't require a flush since the library can handle the search, however queries would be much more complicated, and so if AUTO is set, it will flush it first. If the mode is set to COMMIT, it will only flush the changes to the database upon a call to commit or flush. If COMMIT is set, and a query is run, it will not return results that have not been flushed.

来源:Another stack overflow question

关于java - AUTO 和 COMMIT FlushMode 之间有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24759664/

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