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

Consider @Where annotation for count query #2323

Merged
merged 2 commits into from
Jun 23, 2023
Merged

Consider @Where annotation for count query #2323

merged 2 commits into from
Jun 23, 2023

Conversation

radovanradic
Copy link
Contributor

Should fix #2162

@radovanradic radovanradic requested a review from dstepanov June 23, 2023 11:45
@@ -30,3 +30,4 @@ src/main/docs/resources/css/*.css
src/main/docs/resources/js/*.js
src/main/docs/resources/style/*.html
src/main/docs/resources/img/micronaut-logo-white.svg
**/.micronaut/test-resources/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some test-resources files started showing up recently, it's safe to ignore these paths.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What files are those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this, and I think these files have port numbers for testcontainers 🤷‍♂️

Screenshot 2023-06-23 at 3 06 52 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's indeed safe to ignore these: the Gradle plugin behavior has been aligned to that of the Maven plugin which creates .micronaut directories. This also has the side effect of allowing to use test resources even if not delegating builds to Gradle.

@@ -255,7 +255,7 @@ protected MethodMatchInfo build(MethodMatchContext matchContext) {
}
countQuery.join(joinPath.getPath(), joinType, null);
}
countQueryResult = queryBuilder.buildQuery(countQuery);
countQueryResult = queryBuilder.buildQuery(annotationMetadataHierarchy, countQuery);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the cause of the issue, when building count query method annotation metadata is not passed so we don't have information about @Where annotation.
This was probably not done by mistake, maybe wanted to avoid @Join or something else but I tested and count query with this change still does not consider joins so should be safe. Anything else @dstepanov could perhaps be the reason why annotation metadata was not passed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a mistake

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably delete all the methods without the annotations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was mainly used from tests, removed it df6d6db

@radovanradic radovanradic added the type: bug Something isn't working label Jun 23, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@radovanradic radovanradic merged commit febd62e into master Jun 23, 2023
@radovanradic radovanradic deleted the issue-2162 branch June 23, 2023 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@Where annotation not considered for count query when returning Page
3 participants