Adam Warski commented on Bug HHH-6317

So the problem here is that when you retrieve an audited entity at revision X, you expect to see it as it was at that time. In particular, you expect anEntityAtRevisionX.target to point to the TargetEntity, to which it pointed at that point in time (even though TargetEntity isn't audited, but the relation is).

(Imagine this scenario: there exist two TargetEntities, te1 and te2. They are constant and never change. Now you do:
Revision one: persist(AnEntity where id = 1 and target = te1, AnEntity where id = 2 and target = te2)
Revision one: persist(AnEntity where id = 1 and target = te2, AnEntity where id = 2 and target = te1)

Now you read AnEntity at revision one. If I understand the patch correctly, anEntityAtRevision1.target would return te2, as in the "current" version, te2 points to AnEntity with id 1. But at revision one, it was pointing at te1)

In fact when TargetEntity isn't audited, any information regarding relations that it owns gets lots.
So the correct solution would be to:

  • forbid such mappings
  • add a very-special-case, which stores the history of the relation using a middle-table or in the history of AnEntity
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira