【问题标题】:@LastModifiedDate is not updating when some of the columns are null in spring boot当 Spring Boot 中的某些列为空时,@LastModifiedDate 不会更新
【发布时间】:2023-03-25 02:00:02
【问题描述】:

我有一张桌子,其中有@lastModifiedDate 列。

我在表格中有一个status 列,最初是null,在成功交易后status 正在更新。

status 字段更新时,@lastModifiedDate 也需要更新,但仍显示相同的日期和时间。谁能提供我的解决方案?

【问题讨论】:

    标签: java postgresql spring-boot spring-data


    【解决方案1】:

    你注意到@EnableJpaAuditing@Configuration了吗?

    你也应该用你的实体类声明@EntityListeners(AuditingEntityListener.class)

    更多详情可以查看https://www.baeldung.com/database-auditing-jpa

    【讨论】:

    • 是的,我做过那个。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-08
    • 2021-06-18
    • 1970-01-01
    • 2020-12-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多