How to update entries in a database created by spring and jpa

123 Views Asked by At

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

1

There are 1 best solutions below

0
On

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.