First, the main facts: Java webapp, Spring, Hibernate, MySQL.
The situation is that I have a complex object model, for example. a car . It consists of many objects (Engine, Tires, ...) with one-to-many and one-to-many relationships between them.
Now there are a lot of cars, and from time to time someone checks the car and creates a Test Report . The report applies to many parts of the car, displaying their properties, etc.
Until now, the system did not support the ability to update the properties of the car and its parts after they are submitted to the system. This means that if the color of the chassis or the number of tires has been changed, old reports reflect this change, which we do not want.
Well, now this feature has been requested. Cars and their parts must be modifiable, and version history must be created. In older reports, you must reference the old versions of the parts and their meanings.
I looked at “ slowly changing dimensions ” and it seems that version control of the car and its parts can be done using Approach Type 6.
A thing (twist) that I find it difficult to figure out (possibly due to my limited experience in sleep mode):
How can I collect copies of my report with Hibernate so that they refer to the correct versions of each part of the car? There is a date in the reports, and each version of the car parts will have date ranges when they were valid, so I think I could do it with some complex HQL / SQL language. But is there a simpler, more automatic way to do this with Hibernate?
java mysql versioning hibernate
Janne
source share