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

No entity type expressions can be used in the Envers Query API

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 5.2.9
    • Fix versions: 6.0.0.Beta1
    • Components: hibernate-envers
    • Labels:
      None
    • Last commented by a user?:
      true
    • Sprint:

      Description

      While HQL supports entity type expressions (see user guide 15.32) the envers query API does not support them.

      I suggest to introduce four new methods on AuditEntity: entityType(Class entityType), entityType(String entityName), entityType(String alias, Class entityType) and entityType(String alias, String entityName) which all return an AuditCriterion. The first two are needed because we might specify the desired type either by entity name or by class literal (A translations to the effective audited entity name must be made in the implementation). The other two methods are necessary such that a custom alias can be specified on which the type check should be applied.

      Code example:

      AuditReader reader = ...;
      reader.createQuery()
        .forEntitiesAtRevision(EntityA.class, 3)
        .add(AuditEntity.entityType(EntityB.class))
      

      This example will only return those entities of type EntityA which are really of (sub-)type EntityB.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: