开发者

Does Hibernate Envers creates revision to audit tables if you update without changing any field values?

I am currently testing hibernate envers and I am confused with its behavior. Sometimes when we do updates without doing any changes, it does not record an audit. But cur开发者_运维技巧rently, it does. Just like to make sure.


This can occur if Hibernate does not have access to the old state of the entity to compare to the new state. This typically occurs with when persisting detached entities. When there is no old state to compare, Hibernate assumes that the audited property has changed and logs a revision.

You can get around this issue by re-attaching detached entities using the merge() method before persisting the entity.


From my experience, it only creates an entry in the revision table if you have made changes to the entity.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜