Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] azure-spring-data-cosmos Query Methods always require Criteria inappropriately #40092

Closed
KimTaehee opened this issue May 9, 2024 · 4 comments · Fixed by #40167
Closed
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.

Comments

@KimTaehee
Copy link

KimTaehee commented May 9, 2024

Describe the bug
azure-spring-data-cosmos Query Methods(=Query Creation) always require Criteria. But it is not correct. Isn't it a bug?
For example:

User findFirstByOrderByLastnameAsc();  // not working, but working expected
User findTopByOrderByAgeDesc();  // not working, but working expected
User findFirstByOrderByIdDesc();  // not working, but working expected
Iterable<User> findAllByOrderByIdDesc();  // not working, but working expected
User findFirstByIdIsNotNullOrderByIdDesc();  // working, because there is an IS_NOT_NULL type criteria

Ref.: https://docs.spring.io/spring-data/commons/reference/repositories/query-methods-details.html#repositories.limit-query-result

Exception or Stack Trace
NPE on AbstractQueryGenerator.generateQueryBody()

java.lang.NullPointerException: Cannot invoke "com.azure.spring.data.cosmos.core.query.Criteria.getType()" because "criteria" is null

To Reproduce
Import azure-spring-data-cosmos:5.11.0 and create a repository and methods above.

Thank you.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. labels May 9, 2024
Copy link

github-actions bot commented May 9, 2024

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kushagraThapar @pjohari-ms @TheovanKraay.

@kushagraThapar
Copy link
Member

@trande4884 can you please investigate this issue, thanks!

@trande4884
Copy link
Member

@KimTaehee these are repository queries correct?

@KimTaehee
Copy link
Author

@KimTaehee these are repository queries correct?

Hello. I believe the queries above are correct because some of these are in the Spring Data official doc.

User findFirstByOrderByLastnameAsc();
User findTopByOrderByAgeDesc();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.
Projects
None yet
3 participants