Hibernate Envers (Criteria API) automatically adds a clause 'order by' by ID Revision when not is added projection and not is added order. This procedure burdening the query performance for a user, resulting in a warning that the I/O limit was exceeded.
In order to allow the user to be able to disable this behaviour, I propose that the addOrder method in AbstractAuditQuery.java be updated so that if a Null value is passed as a parameter, no action occurs, but the hasOrder flag is set to true. This should not break existing queries as addOrder previously throw a NullPointerException if null was passed as a parameter.
Hence, this allows users to create an AuditQuery as follows if they do not want the 'Order By' statement:
AuditQuery query = getAuditReader()
.createQuery()
.forRevisionsOfEntity(StrIntTestEntity.class, false, true)
.addOrder(null);
See also: https://bugzilla.redhat.com/show_bug.cgi?id=1247316
|