Order by more than one property in criteria builder's params
- Langage dominant
- Groovy
- Étoiles
- 2.9k
- Forks
- 975
- Merge moyen
- 1 j 22 h
- PR mergées (30 j)
- 92
Description
Sort parmeter in param map for Criteria builder doesn't work the same way as in Dynamic Finders. In dynamic finder we could do this:
```
Author.findAllByNameLike("A%", [sort: [name: "desc", id: "asc"]])
```
If we try to do the same for Criteria builder or with Detached Criteria:
```
Author.createCriteria().list(sort: [name: "desc", id: "asc"]) {
like 'name', "A%"
}
```
The ClassCastException will be thrown:
```
java.util.LinkedHashMap cannot be cast to java.lang.String. Stacktrace follows:
Message: java.util.LinkedHashMap cannot be cast to java.lang.String
Line | Method
->> 1615 | invokeMethod in org.grails.orm.hibernate.query.AbstractHibernateCriteriaBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez à la ligne 1615 de org.grails.orm.hibernate.query.AbstractHibernateCriteriaBuilder et reproduisez la ClassCastException avec l’exemple de Criteria builder présenté dans l’issue. Comparez la gestion des paramètres avec le comportement de Dynamic Finder ; le travail est terminé lorsque Criteria et Detached Criteria acceptent plusieurs propriétés de tri dans l’ordre indiqué.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Domaine
- databases
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100