But I'm not sure of that while reading you're discussion and, as Piotr Findeisen says it, I'll be afraid to go this way for the next versions.
I would be afraid too, but sometimes running with a risk is better than not running at all  In fact, we (my company) have at least several production installations using Envers + my patch mentioned above (https://github.com/hibernate/hibernate-orm/pull/1054) that disables the requirement that older versions exist. Of course, as Gail Badner noted, this is code cannot be merged as is and I presume such behavior needs to be made configurable (opt-in; anyone willing to take it from here?). Having said that I'd like to note that yet a different solution lives in my dream world. In dream world, when old version is not found in the AUD table, it's inserted there. Of course, we will not have a correct date for such a "fabricated" version, but saving old version would allow to show what changes were done that resulted in now-new version. Especially useful if you have some kind of admin UI showing AUD records and comparing them to show changes made by users. .... However, although technically very related, I guess this is a story for a completely new issue. |