You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting data via a queryDSL repository with a pagable applied and a specific QSort order returns the desired result. Feeding it back to a rest controller endpoint will result in an exepection thrown by jackson because of a cyclic dependency in the sort path:
org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class com.querydsl.core.types.Path<java.lang.Object>]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Direct self-reference leading to cycle (through reference chain: org.springframework.data.domain.PageImpl["pageable"]->org.springframework.data.domain.PageRequest["sort"]->org.springframework.data.querydsl.QSort["orderSpecifiers"]->java.util.Arrays$ArrayList[0]->com.querydsl.core.types.OrderSpecifier["target"]->com.querydsl.core.types.PathImpl["metadata"]->com.querydsl.core.types.PathMetadata["parent"]->my.package.model.QMyEntity["created"]->com.querydsl.core.types.dsl.DateTimePath["root"]->com.querydsl.core.types.PathImpl["root"])
Steps to reproduce
Spring Project with QueryDSL and Jackson configured
Create an entity and a repository with QueryDSL support
Getting data via a queryDSL repository with a pagable applied and a specific QSort order returns the desired result. Feeding it back to a rest controller endpoint will result in an exepection thrown by jackson because of a cyclic dependency in the sort path:
Steps to reproduce
To work around this error, you can supply some custom jackson mixins to avoid the serialization of specific fields:
Kotlin Code
This is obviously only a valid workaround when you are using jackson within your project. A general purpose solution should be preferred.
Using Spring Boot 2.6.6 with
spring-boot-starter-data-jpa
and QueryDSL 5.0.0The text was updated successfully, but these errors were encountered: