Everyone,
I have been looking through the documentation, forums etc and can not seem to see if Hibernate supports out of the box what I am needing.
I have a simple need to have a version history or what some have called an audit trail, but I want them in the same table. The use case is this:
Take 3 edits and the current state below of a Cost/Price table with some changes over time, these are grouped with a common/same groupID.
Row 1 id="1" "Product Name" "Cost 1" GroupID="1"
Row 2 id="2" "Product Name" "Cost 2" GroupID="1"
Row 3 id="3" "Product Name" "Cost 3" GroupID="1"
At some point in the past a customer has selected the product while its cost was @Cost 2. We need to honor that cost. With a simple foriegn key I am able to find Row 2 and the cost. It is not so obvious to me in hibernate how I would go about maintaining those GroupIDs on edits and then make sure these foriegn keys would work.
I need to obviously on an edit page only show the Row 3 so when I edit it I get row 4 and then show row 4 as my latest and greatest.
Of course I also might need to mark rows as deleted, active or other states and a few other needs that I think would cloud what I am asking for.
Basically in simple terms there are no deletes or updates in these tables, just Inserts to maintain state and info.
If someone could help me out it would be great.
Thank You
Jim Tyrrell
|