Skip to content

HHH-18898 fix of a NPE when using an embeddable with a specified JavaType #10235

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

peter1123581321
Copy link
Contributor

@peter1123581321 peter1123581321 commented May 28, 2025

When using @JavaType in an @Embeddable annotaded class, a NPE occurs when the field is used as a query parameter.
The AbstractSqlAstTranslator evaluates getSqlTuple(comparisonPredicate.getRightHandExpression()) to null when a SqmParameterInterpretation with a JdbcParameterImpl is given.
Adding a null check resolves the problem.

The bug ticket only describes the NPE in visitRelationalPredicate, but the same problem occurs in visitInListPredicate, so I added a fix for this too in this pull request.
I would expect, that there are even more of similar queries where this can happen.

Further note: the bug was reported using a custom @JavaType but the NPE is also thrown with native ones.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-18898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant