Uploaded image for project: 'Hibernate ORM'
  1. HHH-8567

AuditProperty.property('id') does not reference original id, it references generated composite id of AUD instead

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.1
    • Fix Version/s: 4.2.7, 4.3.0.CR1
    • Component/s: hibernate-envers
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      Steps
      • have an @Audited entity A with @Id Long id
      • Use AuditEntity.property("id")
        • for example: AuditEntity.property("id").desc() to order the results
      expected
      • AuditEntity.property("id") should reference the A.id in the AUD table
        • thus, in the example, the audit query order should be over the ID column
      observed
      • AuditEntity.property("id") seems to reference the generated composite id of the AUD table's entity
        • thus, in the example, the audit query order is over ID, REVID desc
          results are ordered with the wrong order
      apparent workaround
      • whenever you're tempted to write AuditEntity.property("id"),
        use AuditEntity.property("originalId.id") instead. The "originalId" is not something documented, except for a @lukasz.antoniak's comment in HHH-8036 Closed

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: