fix(aot): handle null equality parameters in derived repository queries - #4309
Open
arimu1 wants to merge 2 commits into
Open
fix(aot): handle null equality parameters in derived repository queries#4309arimu1 wants to merge 2 commits into
arimu1 wants to merge 2 commits into
Conversation
AOT materializes a single JPQL string for derived methods and previously always rendered SIMPLE_PROPERTY as path = :param. At runtime, PartTree rewrites null arguments to IS NULL / IS NOT NULL. Render null-safe equality predicates for AOT PartTree queries so fixed queries match runtime semantics for null and non-null arguments. Fixes spring-projects#4304 Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
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.
Overview
Fixes #4304
AOT repository generation materializes a single JPQL string for derived query methods. Equality predicates were always rendered as
path = :param, so anullargument never matched rows with SQLNULL(runtimePartTreerewrites those cases toIS NULL/IS NOT NULLper invocation).This change renders null-safe equality for AOT PartTree queries:
That keeps one static, readable query (aligned with AOT goals) while matching runtime null/non-null semantics for derived finders.
Scope notes
PartTree) methods generated by AOT.@Query/ native queries are unchanged and keep the query as written (same as the non-AOT runtime path; null →IS NULLrewriting is a PartTree feature).=andIS NULLonbyte[]/ BLOB).Checklist
Tests
Temurin 21:
JpaQueryCreatorTests(null-safe JPQL rendering)JpaRepositoryContributorIntegrationTests(null + non-null derived equality / not-equality)JpaRepositoryMetadataIntegrationTests(metadata query string)AotUserRepositoryTests— 284/284 (incl. binary data still OK)DCO:
Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>