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

Envers projection max causes mysql syntax error

    Details

    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

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

      Description

      Envers causes SQL Error: 1064, SQLState: 42000 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version error when adding projection with max

      AuditQuery query = AuditReaderFactory.get(entityManager).createQuery().forRevisionsOfEntity(Relationship.class, true, true)
      .addProjection(AuditEntity.property("id").max()) //this line causes problem
      .add(AuditEntity.revisionNumber().gt(1l))
      .add(AuditEntity.revisionType().eq(RevisionType.DEL));

      which generates select max(relationsh0_.`id`, relationsh0_.rev) as col_0_0_ from `aud_relationships_aud` relationsh0_ where relationsh0_.rev>? and relationsh0_.revtype=?, which is invalid sql.

      Expected sql: select max(relationsh0_.`id`) as col_0_0_ from `aud_relationships_aud` relationsh0_ where relationsh0_.rev>? and relationsh0_.revtype=?

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: