如何更新Spring和JPA创建的数据库中的条目

发布于 2025-01-30 13:34:14 字数 206 浏览 2 评论 0原文

我应该按年份在数据库中版本版本。因此,如果我从2023年开始收到一个新文件,则应根据年更改条目。我找不到任何对版本数据有用的东西。在大多数情况下,他们使用时间戳。但是,我不应该通过特定的时间网络来版本,而是到数据来的一年。每年可以更改数据,并且根据应修改记录的年份。

我正在使用JPA,Spring Boot,Spring Web,H2数据库和Spring Batch在Java上工作

i'm supposed to version the records in a database by year. so if i get a new file from the year 2023 the entries should be changed according to the year. i'm not finding anything useful to versioning data. in most cases, they use timestamps.but i'm not supposed to version the data by a specific timestemp but by the year the data is from. the data can be changed each year and according to the year the records should be modified.

i'm working on java with jpa, spring boot, spring web, h2 database and spring batch

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我是有多爱你 2025-02-06 13:34:14

以下选项可能很有用。

  1. 保存时间戳时,只要需要,您就可以从时间戳中获取并提取年份,请忽略时间戳的其他组件(日,月,时间),并在与年份中使用。
  2. 您可以在存储年中添加其他自定义列。

Below option may be useful.

  1. When you save the timestamp, then whenever required you can fetch and extract year part from the timestamp, ignore other components of the timestamp (day, month, time) and use it in comparison against year.
  2. You can add additional customized column to store year.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文