We're updating the issue view to help you get more done. 

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

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

Environment

None

Status

Assignee

Lukasz Antoniak

Reporter

Piotr Findeisen

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

4.1.1

Priority

Major