Skip to content

querydsl predicate using IN operator returns no results with @DBRef #4716

Not planned
@hhamzic1

Description

@hhamzic1

I'm having this setup:

public class BulkEntity {

    @Id
    private String id;

    @NotNull
    private Long bulkId;

    @NotNull
    private String bulkName;

    @NotNull
    @DBRef
    private OperatorEntity operator;
}

and

public class OperatorEntity {

    private String id;

    @NotNull
    private String name;
}

the corresponding QBulkEntity and QOperatorEntity classes are generated and I see no problem with them, but when I try to call bulkRepository.findAll with predicate that uses IN operator it doesn't work (returns no results)

example:

var operatorIds = List.of("6659aaf9e6f5547ba1e1aca5", "6659aaf9e6f5547ba1e1aca7");
var operatorIdPath = Expressions.stringPath("operator.id");
var predicate = operatorIdPath.in(operatorIds);
var entityPage = bulkRepository.findAll(predicate);

entityPage returns no result, even though entities with the ID's are present in 'operators' collection.

Is this an issue or I'm doing something wrong?

I found similar ticket that explains this problem back in 2017

versions that I use are:

spring-boot-starter-data-mongodb (3.3.0)
querydsl-mongodb (5.1.0)
querydsl-apt (5.1.0)
morphia (1.3.2)

Activity

christophstrobl

christophstrobl commented on Jun 11, 2024

@christophstrobl
Member

thanks for reporting - to speed things up a bit, do you have a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem?

spring-projects-issues

spring-projects-issues commented on Jun 18, 2024

@spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues

spring-projects-issues commented on Jun 25, 2024

@spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    querydsl predicate using IN operator returns no results with @DBRef · Issue #4716 · spring-projects/spring-data-mongodb