gpt4 book ai didi

java - Hibernate Envers - 包括更改发生的日期

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:15:59 26 4
gpt4 key购买 nike

我们刚刚开始使用 Hibernate Envers,它可以很好地记录什么 发生了变化,但是,有没有一种方法它也可以记录何时发生变化?

那么,是否可以在审计表中增加一个datetime列呢?

根据 Envers 文档,这应该默认发生:

When Envers starts a new revision, it creates a new revision entity which stores information about the revision. By default, that includes just

  • revision number - An integral value (int/Integer or long/Long). Essentially the primary key of the revision
  • revision timestamp - either a long/Long or java.util.Date value representing the instant at which the revision was made. When using a java.util.Date, instead of a long/Long for the revision timestamp, take care not to store it to a column data type which will loose precision.

因此,我的理解是,获取修订时间戳不需要任何必要的操作。但是,就我而言,envers 创建的表中没有修订时间戳。

谢谢

最佳答案

有一个由 envers 自动创建的名为:REVINFO 的表,其中包含时间戳。

它包含 REV 作为关键字,它是您在“_AUD”表中的修订号。此数字在所有“_AUD”表格中是唯一的。

参见段落:15.8。了解 Envers 模式 https://docs.jboss.org/hibernate/orm/4.0/devguide/en-US/html/ch15.html

关于java - Hibernate Envers - 包括更改发生的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35433598/

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