Skip to content

NEGATING_SIMPLE_PROPERTY should use IS NOT NULL when argument is null #3675

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

Closed
mp911de opened this issue Nov 14, 2024 · 0 comments
Closed

NEGATING_SIMPLE_PROPERTY should use IS NOT NULL when argument is null #3675

mp911de opened this issue Nov 14, 2024 · 0 comments
Assignees
Labels
type: enhancement A general enhancement

Comments

@mp911de
Copy link
Member

mp911de commented Nov 14, 2024

With #541 (DATAJPA-121), we introduced a long time ago rewrite from foo = ? to foo IS NULL if the query method argument yields null. We should consistently rewrite its negating form from foo <> ? to foo IS NOT NULL if the query method argument is null.

@mp911de mp911de added the type: enhancement A general enhancement label Nov 14, 2024
bezzang-dev added a commit to bezzang-dev/spring-data-jpa that referenced this issue Nov 15, 2024
When a query method uses NEGATING_SIMPLE_PROPERTY and the argument is null,
the generated query should now use `IS NOT NULL` instead of `<>`. This ensures
consistent behavior when handling null values across queries.

Changes:
- Updated `JpaQueryCreator` to handle null arguments in `NEGATING_SIMPLE_PROPERTY` by rewriting `<>` to `IS NOT NULL`.

Closes spring-projects#3675
bezzang-dev added a commit to bezzang-dev/spring-data-jpa that referenced this issue Nov 15, 2024
When a query method uses NEGATING_SIMPLE_PROPERTY and the argument is null,
the generated query should now use `IS NOT NULL` instead of `<>`. This ensures
consistent behavior when handling null values across queries.

Changes:
- Updated `JpaQueryCreator` to handle null arguments in `NEGATING_SIMPLE_PROPERTY` by rewriting `<>` to `IS NOT NULL`.

Closes spring-projects#3675
@christophstrobl christophstrobl added this to the 3.5 M1 (2025.0.0) milestone Nov 20, 2024
@christophstrobl christophstrobl self-assigned this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants