1 Reply Latest reply on May 8, 2009 3:45 AM by adamw

    Implementing some transparent versioned-retrieval

    ryangardner

      Here's a scenario that is similar to what I want to do with envers, but easier to describe.

      If you were creating an inventory system for a store, and had envers tracking all changes to your inventory domain model - and a point of sale system that stored references to various inventory items...

      Without envers, this system would be flawed for trying to retrieve any historical data on the receipts... (i.e. printing a past receipt or looking at a past invoice) since the data would always show the most recent version.

      Is there a way to implement a system in envers where you can automatically snag the list of objects at their respective snapshots (i.e. when getting a range of invoices - specify that it should load the associated entities from envers based on the time or date of the invoice? or based on a revision number stored in the invoice?)

      I'm interested in being able to generate reports that contain snapshots to what the data looked like at the time of a specific event (similar to the invoice idea)

        • 1. Re: Implementing some transparent versioned-retrieval
          adamw

          Hello,

          well, if you have a revision number (or a date - you can get a revision number basing on that), you can either get an object at a specific revision using the "find" method of audit reader (then any associations that you traverse will also be fetched at that given point of time), or use the entities-at-revision query to get more objects. Is that what you were looking for?

          Adam