Skip to content

QueryDSL: Struggling with syntax on how to bind for a sub-list field with QList [DATACMNS-1298] #1740

Open
@spring-projects-issues

Description

@spring-projects-issues

GT opened DATACMNS-1298 and commented

I apologize as I am little confused if this is a QueryDSL issue or else a Spring QueryDSL extension issue. I have explained the issue in QueryDSL github forum -

querydsl/querydsl#2293

To add further, I am using those generated class of QType with Spring Data Web support. With that class structure, I am unable to pass requestParameters as -

emails.email.value=johndoe@rocketmail.com
neither
emails.value=johndoe@rocketmail.com

Both of above fails because of invalid field on QList type as emails type is QList in generated code.

If i just use emails.value = johndoe@RocketEmail.com

then i am forced to register a String to List<Email> converter which i feel like shouldn;t be required.

My API method is very simplistic -

public ResponseEntity<Users> searchUser(@ApiIgnore @QuerydslPredicate(root = User.class) Predicate predicate) {
        if (predicate == null || (BooleanBuilder.class.isAssignableFrom(predicate.getClass()) && !((BooleanBuilder)
                predicate).hasValue())) {
            return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
        } else {
            Users result = StreamSupport.stream(this.userRepository.findAll(predicate)
                                                                   .spliterator(), false)
                                        .collect
                                                (Collectors
                                                         .toCollection(() -> new Users()));
            return ResponseEntity.ok(result);
        }

Appreciate any guidance on how can I bind to sub-lists which are generated as QList and not as ListPath


Affects: 2.0.6 (Kay SR6)

Reference URL: querydsl/querydsl#2293

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions