java - 为什么休眠在插入和更新之前显示提交日志?
问题描述
休眠日志显示:
[debug] o.h.e.t.i.TransactionImpl - begin
do stuff...
[debug] o.h.e.t.i.TransactionImpl - committing
do more stuff... inserts, updates etc...
[debug] o.h.e.j.i.JdbcCoordinatorImpl - HHH000420: Closing un-released batch
当它“应该”这样做时
[debug] o.h.e.t.i.TransactionImpl - begin
do stuff...
do more stuff... inserts, updates etc...
[debug] o.h.e.t.i.TransactionImpl - committing
我将整个事情包装在一个事务中,所以我不认为这是我的代码的问题。我错过了什么吗?
解决方案
Hibernate 有 3 种状态:Transient、Persistent 和 Detached。我认为它会显示commit
从瞬态状态变为持久状态的时间。但是,这并不意味着事务真正提交。只是意味着对象已被 Hibernate 控制并准备好提交到数据库一段时间(取决于 Hibernate 内部机制)。如果我错了,请纠正我。
推荐阅读
- javascript - 当屏幕大小低于断点时将类附加到 div
- flutter - 在 Streambuilder 中合并两个流并返回一个 ListView (Flutter)
- javascript - Chrome 扩展 - 从清单 v2 迁移到 v3
- python - selenium 中的 self.start_error_message)
- mysql - Mysql查询从多条记录中获取最低字段值
- bash - 如何匹配文本文件中的字符?
- php - 如何在 PHP 中验证图像 URL 的尺寸和格式?
- reactjs - 反应条件页面渲染
- javascript - 开玩笑在 DOM 链中测试属性更新
- java - jdk- 15.0.1_windows-x64_bin.exe 未打开