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=?
|