apache / apache/grails-core

sort broken for finder with no critera

Open
#11,657 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Steps to Reproduce

Using a finder with no criteria, the sort criteria doesn't work. e.g.

Booking.findAll([sort: ['email': 'desc', 'lastUpdated': 'desc']])

the sort criteria here has no effect. By contrast, if I do:

Booking.findAllByVersion(0, [sort: ['email': 'desc', 'lastUpdated': 'desc']])

the sort criteria works as expected

### Expected Behaviour

Even with no criteria, findAll should sort properly.

### Actual Behaviour

No sorting occurs.

### Environment Information

- **Operating System**: Windows
- **Grails Version:** 4.1.0.M2
- **JDK Version:** 1.8.0_271 Oracle

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in Grails 4.1.0.M2 with the two Booking.findAll examples and compare their generated query or results. Trace the finder path used when no criteria are supplied; done means sort options are honored for findAll just as they are for findAllByVersion.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.