Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用QueryDSL和分页的Spring引导:嵌套数组元素上的页面排序不起作用_Java_Spring_Sorting_Pagination_Querydsl - Fatal编程技术网

Java 使用QueryDSL和分页的Spring引导:嵌套数组元素上的页面排序不起作用

Java 使用QueryDSL和分页的Spring引导:嵌套数组元素上的页面排序不起作用,java,spring,sorting,pagination,querydsl,Java,Spring,Sorting,Pagination,Querydsl,我使用Spring Boot QueryDSL过滤实体和Spring Boot Page功能进行分页和排序,以便调用以下方法: Page<Country> all=countryRepository.findAll(predicate,pageable); 我得到以下结果: [ { "id": "DE", "currency": "EUR", "preSelection": 49,

我使用Spring Boot QueryDSL过滤实体和Spring Boot Page功能进行分页和排序,以便调用以下方法:

Page<Country> all=countryRepository.findAll(predicate,pageable);
我得到以下结果:

 [
        {
            "id": "DE",
            "currency": "EUR",  
            "preSelection": 49,
            "currencySign": "€",
            "translations": [
                {
                    "id": "11",
                    "name": "Deutschland",
                    "text": null,
                    "languageId": "de"
                },
                {
                    "id": "322",
                    "name": "Allemagne",
                    "text": null,
                    "languageId": "fr"
                },
                {
                    "id": "18",
                    "name": "Germany",
                    "text": null,
                    "languageId": "en"
                }
            ]
        },
        {
            "id": "ES",  
            "currency": "EUR",
            "preSelection": 34, 
            "currencySign": "€",
            "translations": [
                {
                    "id": "16",
                    "name": "Spanien",
                    "text": null,
                    "languageId": "de"
                },
                {
                    "id": "23",
                    "name": "Spain",
                    "text": null,
                    "languageId": "en"
                }
            ]
        },
        {
            "id": "PT",
            "currency": "EUR",
            "preSelection": 351,
            "currencySign": "€",
            "translations": [
                {
                    "id": "24",
                    "name": "Portugal",
                    "text": null,
                    "languageId": "en"
                },
                {
                    "id": "17",
                    "name": "Portugal",
                    "text": null,
                    "languageId": "de"
                }
            ]
        }
]
好的,那就行了! 但现在我想根据收集的翻译对象,根据它们的德语名称,对我的国家对象进行排序:

http://localhost:8090/countries?translations.languages.id=de&sort=translations.name
结果是:

 [
    {
        "id": "DE",
        "currency": "EUR",
        "preSelection": 49,
        "currencySign": "€",
        "translations": [
            {
                "id": "11",
                "name": "Deutschland",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "322",
                "name": "Allemagne",
                "text": null,
                "languageId": "fr"
            },
            {
                "id": "18",
                "name": "Germany",
                "text": null,
                "languageId": "en"
            }
        ]
    },
    {
        "id": "DE",
        "currency": "EUR",
        "preSelection": 49,
        "currencySign": "€",
        "translations": [
            {
                "id": "11",
                "name": "Deutschland",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "322",
                "name": "Allemagne",
                "text": null,
                "languageId": "fr"
            },
            {
                "id": "18",
                "name": "Germany",
                "text": null,
                "languageId": "en"
            }
        ]
    },
    {
        "id": "DE",
        "currency": "EUR",
        "preSelection": 49,
        "currencySign": "€",
        "translations": [
            {
                "id": "11",
                "name": "Deutschland",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "322",
                "name": "Allemagne",
                "text": null,
                "languageId": "fr"
            },
            {
                "id": "18",
                "name": "Germany",
                "text": null,
                "languageId": "en"
            }
        ]
    },
    {
        "id": "PT",
        "currency": "EUR",
        "preSelection": 351,
        "currencySign": "€",
        "translations": [
            {
                "id": "24",
                "name": "Portugal",
                "text": null,
                "languageId": "en"
            },
            {
                "id": "17",
                "name": "Portugal",
                "text": null,
                "languageId": "de"
            }
        ]
    },
    {
        "id": "PT",
        "currency": "EUR",
        "preSelection": 351,
        "currencySign": "€",
        "translations": [
            {
                "id": "24",
                "name": "Portugal",
                "text": null,
                "languageId": "en"
            },
            {
                "id": "17",
                "name": "Portugal",
                "text": null,
                "languageId": "de"
            }
        ]
    },
    {
        "id": "ES",
        "currency": "EUR",
        "preSelection": 34,
        "currencySign": "€",
        "translations": [
            {
                "id": "16",
                "name": "Spanien",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "23",
                "name": "Spain",
                "text": null,
                "languageId": "en"
            }
        ]
    },
    {
        "id": "ES",
        "currency": "EUR",
        "preSelection": 34,
        "currencySign": "€",
        "translations": [
            {
                "id": "16",
                "name": "Spanien",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "23",
                "name": "Spain",
                "text": null,
                "languageId": "en"
            }
        ]
    }
]
好吧,那没用!有没有可能让它起作用

提前感谢您的回复

 [
    {
        "id": "DE",
        "currency": "EUR",
        "preSelection": 49,
        "currencySign": "€",
        "translations": [
            {
                "id": "11",
                "name": "Deutschland",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "322",
                "name": "Allemagne",
                "text": null,
                "languageId": "fr"
            },
            {
                "id": "18",
                "name": "Germany",
                "text": null,
                "languageId": "en"
            }
        ]
    },
    {
        "id": "DE",
        "currency": "EUR",
        "preSelection": 49,
        "currencySign": "€",
        "translations": [
            {
                "id": "11",
                "name": "Deutschland",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "322",
                "name": "Allemagne",
                "text": null,
                "languageId": "fr"
            },
            {
                "id": "18",
                "name": "Germany",
                "text": null,
                "languageId": "en"
            }
        ]
    },
    {
        "id": "DE",
        "currency": "EUR",
        "preSelection": 49,
        "currencySign": "€",
        "translations": [
            {
                "id": "11",
                "name": "Deutschland",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "322",
                "name": "Allemagne",
                "text": null,
                "languageId": "fr"
            },
            {
                "id": "18",
                "name": "Germany",
                "text": null,
                "languageId": "en"
            }
        ]
    },
    {
        "id": "PT",
        "currency": "EUR",
        "preSelection": 351,
        "currencySign": "€",
        "translations": [
            {
                "id": "24",
                "name": "Portugal",
                "text": null,
                "languageId": "en"
            },
            {
                "id": "17",
                "name": "Portugal",
                "text": null,
                "languageId": "de"
            }
        ]
    },
    {
        "id": "PT",
        "currency": "EUR",
        "preSelection": 351,
        "currencySign": "€",
        "translations": [
            {
                "id": "24",
                "name": "Portugal",
                "text": null,
                "languageId": "en"
            },
            {
                "id": "17",
                "name": "Portugal",
                "text": null,
                "languageId": "de"
            }
        ]
    },
    {
        "id": "ES",
        "currency": "EUR",
        "preSelection": 34,
        "currencySign": "€",
        "translations": [
            {
                "id": "16",
                "name": "Spanien",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "23",
                "name": "Spain",
                "text": null,
                "languageId": "en"
            }
        ]
    },
    {
        "id": "ES",
        "currency": "EUR",
        "preSelection": 34,
        "currencySign": "€",
        "translations": [
            {
                "id": "16",
                "name": "Spanien",
                "text": null,
                "languageId": "de"
            },
            {
                "id": "23",
                "name": "Spain",
                "text": null,
                "languageId": "en"
            }
        ]
    }
]