Fix AOT-generated GreaterThanEqual query to call greaterThanOrEquals - #2374
Open
jejes323 wants to merge 1 commit into
Open
Fix AOT-generated GreaterThanEqual query to call greaterThanOrEquals#2374jejes323 wants to merge 1 commit into
jejes323 wants to merge 1 commit into
Conversation
JdbcCodeBlocks generated Criteria.greaterThanEquals(...) for the GTE comparator, but Criteria only declares greaterThanOrEquals(Object). This made any repository method using the GreaterThanEqual keyword fail to compile under Spring AOT processing, while the sibling LessThanEqual keyword worked correctly. Closes spring-projectsGH-2365 Signed-off-by: leavingisfine <185443765+jejes323@users.noreply.github.com>
jejes323
force-pushed
the
fix-gte-aot-codegen
branch
from
August 31, 2026 05:46
dfbae21 to
8ff0454
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
JdbcCodeBlocks#appendCriteriageneratedCriteria.greaterThanEquals(...)for theGTEcomparator, butCriteriaonly declaresgreaterThanOrEquals(Object). Any repository method using theGreaterThanEqualderived-query keyword therefore failed to compile once Spring AOT processing was enabled (compileAotJava,bootBuildImage,jib, etc.), while the siblingLessThanEqualkeyword worked correctly and generated.lessThanOrEquals(...).Fixes #2365.
Why
Criteriaonly exposesgreaterThanOrEquals(Object)(nogreaterThanEquals), so the generated source referenced a method that doesn't exist:The non-AOT runtime path (
CriteriaFactory) already mapsGREATER_THAN_EQUALtogreaterThanOrEqualscorrectly, so only the AOT source-generation path inJdbcCodeBlockshad the typo.Change
One-word fix:
.greaterThanEquals($L)→.greaterThanOrEquals($L).Tests
Added
findAllByAgeGreaterThanEqualandfindAllByAgeLessThanEqualtoJdbcRepositoryContributorIntegrationTests(and the corresponding derived-query methods to the testUserRepository), asserting the correct result set at the boundary value.findAllByAgeGreaterThanEqualfails to load itsApplicationContextbecause the AOT-compiled fragment doesn't compile (verified locally by reverting the one-line fix)../mvnw -pl spring-data-jdbc test -Dtest=JdbcRepositoryContributorIntegrationTestspasses: 39/39, 0 failures, 0 errors.