Closed marskobe closed 7 years ago
Would you mind rather using StackOverflow for general questions of usage? We use the tracker to keep track of bugs, new features, etc.
ok, thank you
The question is almost the same as http://stackoverflow.com/questions/21166580/spring-data-mongodb-querydsl-dbref-exception
Can you help me solve the problem? thank you very much.
I hava two related entities like this: ` @Document(collection = "lmt_limit") public class LimitEntity implements Serializable { /* * 主键 /
@Id
private Long id;
}
@Document(collection = "lmt_reason") public class ReasonEntity implements Serializable { /* * 主键 /
@Id
private Integer id;
} ` LimitEntity is @DBRef ReasonEntity, and in my mongodb database's lmt_limit Collection I hava two Document like this:
/* 0 */ { "_id" : NumberLong(1), "_class" : "tv.acfun.cloud.service.limit.entity.LimitEntity", "reason" : { "$ref" : "lmt_reason", "$id" : 1 } }
/* 1 */ { "_id" : NumberLong(2), "_class" : "tv.acfun.cloud.service.limit.entity.LimitEntity", "reason" : { "$ref" : "lmt_reason", "$id" : 2 } }
so I want to query LimitEntity by ReasonEntity's attribute like this:
` BooleanBuilder booleanBuilder = new BooleanBuilder(); booleanBuilder.and(QLimitEntity.limitEntity.reason.id.eq(1));
Paginate page = new Paginate(limitRepository.findAll(booleanBuilder, pageRequest)); ` My pageRequest has pageNum as 0, and pageSize as 20, Theoretically the result page should has one data record, but the truth is I have get nothing. so how does this happen ??
My querydsl version is 3.7.4.
Finally I rememberd Original I can get the Correct results,but I don't know why is it suddenly not!!