Skip to content

limit in FetchableFluentQueryBySpecification addes duplicate order by clause #3600

Closed
@JingBh

Description

@JingBh

As this code in FetchableFluentQueryBySpecification shows, adding a limit applies the current sorting again.

@Override
public FetchableFluentQuery<R> limit(int limit) {
Assert.isTrue(limit >= 0, "Limit must not be negative");
return new FetchableFluentQueryBySpecification<>(spec, entityType, resultType, this.sort.and(sort), limit,
properties, finder, scroll, countOperation, existsOperation, entityManager, projectionFactory);
}

In my application, this is causing duplicate order by clause to be included in the SQL generated like order by q1_0."id" desc,q1_0."id" desc, as I call .sortBy first, and then .limit.

Of course, it's easy to fix on the application's side by calling .limit first, but I think this is a bug in the framework, as the other class FetchableFluentQueryByPredicate implementing the same interface does not have this behavior.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions