hibernate.clearSynchronization=true not execute TransactionSynchronizationManagerUtil.bindSynchronization()
时间: 2024-03-20 16:21:42 浏览: 81
hibernateSynchronizer
4星 · 用户满意度95%
The property `hibernate.clearSynchronization=true` is used to clear the synchronization after a transaction. This means that any transaction synchronization registered during the transaction will be unbound and removed.
On the other hand, `TransactionSynchronizationManagerUtil.bindSynchronization()` is used to bind a transaction synchronization to the current thread. This synchronization is then executed after the transaction has completed, either by committing or rolling back.
So, if you set `hibernate.clearSynchronization=true`, any synchronization bound using `TransactionSynchronizationManagerUtil.bindSynchronization()` will be cleared and not executed. Therefore, it's recommended to either remove the `hibernate.clearSynchronization` property or not use `TransactionSynchronizationManagerUtil.bindSynchronization()` in your code.
阅读全文