Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

444
Views
SCD (slowly changing dimension) Type 4/6 - how to implement in spring boot app, hibernate envers

I am trying to solve the problem how should I create "logs" for my app and store them to database.

Let's assume I have this database structure:

FIRST TABLE:

weatherstation_id | weatherstation_name | weatherstation_ip_address

SECOND TABLE:

sensor_id | sensor_name | sensor_number | weatherstation_id

THIRD TABLE:

measurement_id | value | measure_date | weatherstation_id | sensor_id

from this I should be able to get the "log" so the measurement value and informations about the weather station and sensor !AT THE TIME WHEN THE MEASUREMENT WAS MADE!, so I need to implement history somehow.

I am trying to solve this for more than two weeks and I have discovered that I should probably go with something like SCD type 4 or 6.

One option which came to my mind is spring-data-envers which should handle the history, but here I don't know how I should "link" the measurement to the revision.

Second option is to write it on my own and use JPA Lifecycle Callbacks and have in my WeatherStation entity list of WeatherStationHistory and before any update or persist add the copy of current WeatherStation there and then have the Measurement pointing to this WeatherStationHistory.

So what I want to know is what is the best way to solve this problem and how to implement it in spring boot application.

I hope I have described my problem clearly. I will be grateful for any advice.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I think you should use the database level options for SCD. Although I don’t know if there’s any benefit to this if it’s implemented at the application level.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!